Filter for label in a formula in Structure

Martin Härri August 25, 2020

I would like to create a formula column in Structure which filters for all issues which have a specific label. E.g. if I search for "Apples" it should find all issues where one of the labels is "Apples", e.g. "Apples, Oranges", "Apples, Pears", and "Apples".

I only manage to create a formula which finds issues where the only label is "Apples", but not issues which contain other labels as well.

Any suggestions which formula to use?

1 answer

1 accepted

0 votes
Answer accepted
Egor Tasa [ALM Works]
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.
August 25, 2020

Hi Martin,

The simplest approach here would be 

IF (SEARCH("Apples", labels) AND !SEARCH(",", labels), "Only apples")

Here it takes advantage of the fact that 0 and undefined are considered false value, so !SEARCH(",", labels) returns 1 if there are no commas in labels string, which means there is only one or no lables at all, for any number it will return 0.

Regards,
Egor Tasa

ALM Works

Martin Härri August 26, 2020

Thank you very much, Egor! I have the impression though that I don't need the second part AND !SEARCH(",", labels), "Only apples"), the formula seems to work with only the first part

Egor Tasa [ALM Works]
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.
August 26, 2020

Hi Martin,

Not sure that SEARCH("Apples", labels) would work as you expected, but you reminded me of MATCH(labels, "Apples") function that should indeed be sufficient.

Regards,
Egor

Martin Härri August 27, 2020

Actually, MATCH was my first thought, but that one works only when the labels field contains "Apples" only. That's why I was looking for an alternative, and SEARCH works perfectly. Thanks again!

Egor Tasa [ALM Works]
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.
August 27, 2020

Sorry, Martin, misread your original requirement. Glad that I could help despite that though.

Cheers,

Egor

Like Martin Härri likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events