5E Product Walkthrough Playlist
  1. #1

    Sort Order of groups in Data Library

    I have a Talents group in my data library that I want to sort either by Letter (alphabetically) or IQ.



    It works, except I get this:



    You can see that the talents listed by IQ are sorted alphabetically.

    I can make it work by setting the aGroupValueOrder for the "byiq" aListViews in my data_library.lua script to be a literal array of numbers, e.g.: {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"}. But it seems like there should be a way to just make it sort numerically?

    Relevant code:

    Code:
    	["talent"] = {
    		["byletter"] = {
    			sTitleRes = "talent_grouped_title_byletter",
    			aColumns = {
    				{ sName = "name", sType = "string", sHeadingRes = "talent_grouped_label_name", nWidth=250 },
    				{ sName = "iq", sType = "number", sHeadingRes = "talent_grouped_label_iq", nWidth=25 },
    			},
    			aFilters = {},
    			aGroups = { { sDBField = "name", nLength = 1 } },
    			aGroupValueOrder = { },
    		},
    		["byiq"] = {
    			sTitleRes = "talent_grouped_title_byiq",
    			aColumns = {
    				{ sName = "name", sType = "string", sHeadingRes = "talent_grouped_label_name", nWidth=250 },
    				{ sName = "iq", sType = "number", sHeadingRes = "talent_grouped_label_iq", nWidth=25 },
    			},
    			aFilters = {},
    			aGroups = { { sDBField = "iq" } },
    			aGroupValueOrder = {},
    		},
    	},
    Attached Images Attached Images
    Last edited by AmadanNaBriona; May 12th, 2020 at 15:34.

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,413
    Even though the original field is a number field, the grouped headings are strings - so it's ordering as a string, not a number. So, for it to be in order you can use the 01, 02, 03 ... 09, 10, 11, 12, 13... etc..

    So, you can override this using the aGroupValueOrder as you've found, or you could convert the value using a sCustom function in aGroups - but you'd have to then use 01, 02, 03...
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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
  •  
FG Spreadshirt Swag

Log in

Log in