-
February 22nd, 2021, 03:02 #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.
-
February 22nd, 2021, 03:59 #2
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
-
February 22nd, 2021, 08:36 #3
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,539
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
-
February 22nd, 2021, 13:55 #4
-
February 22nd, 2021, 17:06 #5
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".
-
February 22nd, 2021, 17:10 #6
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.
-
February 22nd, 2021, 17:29 #7
-
February 22nd, 2021, 17:49 #8
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,539
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
-
February 22nd, 2021, 18:58 #9
-
February 22nd, 2021, 21:38 #10
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