STAR TREK 2d20
Page 1 of 3 123 Last
  1. #1

    peculiar sorting issue (fg classic, story entries)

    .
    i designate prefix to all fg story entries and use this naming convention:
    [book #][part # + *** title ***][section #][subsection alpha][event #]


    sample set of prefixes:
    136-p1 ***
    136-p1-1
    136-p1-2
    136-p1-2a01
    136-p3 ***
    136-p3-1
    136-p3-2
    136-p3-2k05
    136-p3-2m11
    136-p3-4o1
    136-p3-4o2
    136-p3-4o3

    however, 136-p3 *** won't sort property, and fg is placing it out of order in the position below:
    136-p1 ***
    136-p1-1
    136-p1-2
    136-p1-2a01
    136-p3-1
    136-p3-2
    136-p3-2k05
    136-p3-2m11
    136-p3-4o1
    136-p3 *** <--- (coincidentally starts on page 2 of story)
    136-p3-4o2
    136-p3-4o3

    i took the same set and put it in google sheet and it sorted correctly as seen in top set.

    odd thing is, part 1 and part 2 sort properly with same naming convention.

    my current workaround is to add a hyphen: 136-p3- ***

    been staring at it for an hour... bug?
    Last edited by tahl_liadon; February 26th, 2021 at 16:01.
    -----
    roll dice. it builds character.

  2. #2
    Zacchaeus's Avatar
    Join Date
    Dec 2014
    Location
    Scotland
    Posts
    20,737
    I think FG sorts up to the first space. But that’s a guess. Usually I’d expect 01.000, 01.001, 02.000 etc for chapter and story ordering so I’m not exactly sure what happens once you introduce letters into the equation.
    If there is something that you would like to see in Fantasy Grounds that isn't currently part of the software or if there is something you think would improve a ruleset then add your idea here https://www.fantasygrounds.com/featu...rerequests.php

  3. #3
    FG uses a pure case-sensitive alphanumeric sort by name when name sorting is used. (lowercase > uppercase, one character compared at a time).

    Regards,
    JPG

  4. #4
    Quote Originally Posted by Moon Wizard View Post
    FG uses a pure case-sensitive alphanumeric sort by name when name sorting is used. (lowercase > uppercase, one character compared at a time).
    .
    thx that's seems most obvious... and it seems that's what fg is doing.

    but i'm not sure if you had a chance to review and had other insight why that entry would be out of place.
    -----
    roll dice. it builds character.

  5. #5
    Minty23185Fresh's Avatar
    Join Date
    Dec 2015
    Location
    Goldstone, CA, USA
    Posts
    1,211
    Blog Entries
    29
    My experience with the sort, and is has been extensive, due to the Field Filters for All Libraries extension, is that sorting is done with a "shotgun" kind of methodology. Every value in a list is NOT compared against every other value and swapped as needed. Once in a while, you'll experience a peculiarity such as the one shown. It is a built in oddity of the lua library's .sort function. If you really care about it read the lua manual.
    Last edited by Minty23185Fresh; February 22nd, 2021 at 19:39.
    Current Projects:
    Always...
    Community Contributions:
    Extensions: Bardic Inspiration, Druid Wild Shapes, Local Dice Tower, Library Field Filters
    Tutorial Blog Series: "A Neophyte Tackles (coding) the FG Extension".

  6. #6
    Minty23185Fresh's Avatar
    Join Date
    Dec 2015
    Location
    Goldstone, CA, USA
    Posts
    1,211
    Blog Entries
    29
    You might be able to see this oddity in action. Add several more pages numbered right around the anomaly. It might straighten itself out. Oddly enough one or two might not be enough.

  7. #7
    Quote Originally Posted by Minty23185Fresh View Post
    ...Once in a while, you'll experience a peculiarity such as the one shown... If you really care about it read the lua manual.
    .
    lol no, i would not like to read the manual -- i'll take your word for it!

    thx much for the insight. will proceed with my workaround; it's not a biggie.
    -----
    roll dice. it builds character.

  8. #8
    Ok, looks like there is some sort of disconnect between sorting functions in the display list; and the internal overall campaign list filtering. I'll rewrite for the next push.

    Regards,
    JPG

  9. #9
    Quote Originally Posted by Moon Wizard View Post
    I'll rewrite for the next push.
    .
    cool! thx
    -----
    roll dice. it builds character.

  10. #10
    Minty23185Fresh's Avatar
    Join Date
    Dec 2015
    Location
    Goldstone, CA, USA
    Posts
    1,211
    Blog Entries
    29
    I went searching for a citation to verify what I stated in post #5, but I can't find it.
    The lua "programming in lua" pages hint at it but do not specifically state it that way.

    IIRC it boils down to this:
    when one uses table.sort(myTable, mySortFunction);
    every value in myTable is NOT guaranteed to be sent to mySortFunction(a, b)
    and most certainly every value in myTable is NOT guaranteed to be compared
    in mySortFunction(a, b) to every other value in myTable

    I found this to be incredulous, but I verified it for myself a few times when combo box data
    in FFAL was not properly sorted. And sure enough, using Debug.console within the sort function,
    for tables that failed to sort properly the incorrectly placed data item was never sent to the
    sort function.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Starfinder Playlist

Log in

Log in