Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Formatting a smart value list (for email) to say "Service1, Service2, and Service3"

I'm trying to format a smart value list to stick it into a sentence for an email. I have an idea of what I will need to do with conditional logic (i.e. if there is one item, = do this, 2 = do this, 3 or more = do this) but where I'm stuck is formatting the "3 or more" section.

To be readable, I'd like to make it say "Service1, Service2, and Service3" with the "and" instead of another comma being where I'm struggling. I've been looking through documentation and I can't find anything, but it feels like something that might just be expected to know.

After digging around, what I've reached is:

{{#issue.affectedServices}} {{name}}{{^last}}, {{/}}{{/}}

Where I understand by putting "{{^last}}" it's saying do not put the comma after the last item in the list. What I don't understand is how to make it put an "and" in front of the last item of the list instead of a comma after the item.

Thank you!

1 answer

1 accepted

2 votes
Answer accepted
Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Feb 17, 2022

Try this:

{{#issue.affectedServices}} {{#last}}and {{/}}{{name}}{{^last}}, {{/}}{{/}}

Omitting the final comma (before the 'and') is not easy, and arguably not desired (Oxford comma).

Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Feb 17, 2022

See the docs here for examples.

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Feb 17, 2022

Hi @Victoria T 

Yes, and...to what @Mykenna Cepek suggests...

You could also look at the conditional logic and/or new smart value list filtering for more complex formatting: 

For example, you could use a test on {{issue.affectedServices.size}} to check the count for different layouts, concatenating them for 0 values, 1-2 values, or more than 2 values.  Because only one would be non-empty you would get the expected result.

Kind regards,
Bill

@Mykenna Cepek Thank you! This is the exact sort of example I needed to understand what to do next. And you're right, I don't particularly care if the comma before "and" is committed or not. :)

@Bill Sheboy Oh yes, I'm having fun with the conditional logic for these rules. To anyone that might see this, .size is how I'm doing it and it's working.

Like Bill Sheboy likes this
Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Feb 17, 2022

And if the Oxford Comma (or not) isn't pedantic enough for you, wait until you find yourself spending time adding a conditional to pluralize a word when the count is not equal to "1"!

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events