0

Sort a dMC field dynamic values

I've tried adding Sort() to the select station and also the Dynamic Value field and neither seems to work. Anyone know if this is possible?

7 replies

null
    • Fred
    • 1 yr ago
    • Reported - view

    It is possible. Please share your code so we can troubleshoot.

    • Holly_M
    • 1 yr ago
    • Reported - view

    I am doing a simple Select for the Dynamic Table and a single field in the dynamic values called Checklist Items contains the text values.

    dMV Table

    select Checklists

    dMC Values section

    sort(‘Checklist Items’)

    • Fred
    • 1 yr ago
    • Reported - view

    What you are asking it to do is to sort by record Id, which is the default sort so you wouldn’t see any changes.

    What you can try is the order by command:

    select Checklist order by fieldname

    Ninox has more info on their docs site. I have to say I am surprised at how detailed it is. I’ve been using order by with text fields and have not encountered any issues, so you will have to play around to see what works for you.

    • Holly_M
    • 1 yr ago
    • Reported - view

    That did the trick and I was assuming the Sort() was the right one but Order did the trick thanks!

      • Fred
      • 1 yr ago
      • Reported - view

      Holly M When you get a chance please mark this post "answered".

      • Ninox developper
      • Jacques_TUR
      • 1 yr ago
      • Reported - view

      Holly M Sort() function return one table ordered. Exemple :

      var a := ["b", "e", "c", "a", "d"];
      sort(a);

      return :
      a
      b
      c
      d
      e

      sort(select Invoice)

      returns a list of record numbers from the Invoice table sorted from lowest to highest : 
      1
      3
      4
      ....
      43

      In other words, sort() is used to sort a table with a single column. To sort a table with several columns (or several fields), you have to use order by

    • Holly_M
    • 1 yr ago
    • Reported - view

    Fred Highlighting the use of Order in the select statement fixed my issue

Content aside

  • Status Answered
  • 1 yr agoLast active
  • 7Replies
  • 114Views
  • 3 Following