Easiest way to show Oxford comma separated list of text?

I need to display this:

The text can be:

I wanted to avoid reusables and repeating groups to do this one thing that should be easy.

Here’s how I did it:

image

And the condition:

image

(the editor hides the “each item”)

image

It works. Every search is identical. I don’t think WU will blow up.

Is there a better way of doing this?

If so, please publicly correct me without tact.

If not, and you didn’t know about this, here’s your free tip!

Bonus: if you are okay being wrong and want to confuse people, you don’t need to include the comma in the “, and” in the condition. Then your text is still comma separated, but not Oxford.

1 Like

Another method is as follows:

Search for Users:format as text

Text:
This User is Search for Users:last item:formatted as text
When no: This User's name
When yes: and This user's name

Delimiter:
comma and spaces

Search for Users:count > 1:formatted as text
When no: is online
When yes: are online

Don’t know about the WU implications (i.e would this charge a search for the This User is Search for Users:last item for every search?). I think your approach might be more WU efficient.

1 Like

I didn’t even think of the :format as text on the Search. I didn’t even know you could do that.

I think I like your solution better, especially if there’s no suffix required. It’s easier to understand.

I tried your solution in an app and had to make a couple changes. Here is the updated method, built on yours:

[Any List]:format as text

Text:
[List Item] is [Any List]:last item and [Any List]:count is not 1:formatted as text

When yes:
and [List Item]

When no:
[List Item]

Delimiter (from [Any List]:format as text):
[Any List]:count is not 2:formatted as text

When yes:
, (comma space)

When no:
(single space)

This correctly handles any list and will output:

X

X and Y

X, Y, and Z

There are cases where you want a comma in a two item list, but you’re on your own for that.

(Note that this ignores the “is online” thing from my original post)

Thanks again @georgecollier. Feel free to optimize.