Sorting .lookup formula results

#1

I have a table that is returning all the results from another table that match a particular tag.

The formula I’m using is:
Tags.Lookup(Topics, thisRow)

The problem I have is that the returned tags are in a random order (by ID I guess, not by name).

For example, the topic “Emotions and Mental Health” correctly returns these items, but not alphabetized:

brain, celebration, depression, hope, mind, suffering, suicide, anger, grief

I tried using the sort function to alphabetize the results, but apparently I am using it wrong because I either get an error, no results, or the same unsorted results.

I’ve tried the following:
Tags.Lookup(Topics, thisRow).sort()
Tags.sort().Lookup(Topics, thisRow)

…and some other variations, but no luck.

The tables I have are:

  • Tags: tag name, type, topics (lookup with multiple selections possible)
  • Topics: topic name, description
  • Types: topic name, description

What I am trying to create is a table that shows a reverse match of the tags table, where there is a single row for each topic, and it shows a comma-separated list of all the tags that have been assigned to that topic. A single tag can be assigned to multiple topics, and each topic can be referenced by multiple tags. All of this works, except that the list of matching tags is in a random (not alphabetical) order.

#2

Have you tried - Tags.Lookup(Topics, thisRow).[Tag Name].sort()
this will not reference the Tag Name Row but it will sort the list for you.

1 Like
#3

That worked perfectly. Much thanks!

1 Like