97
Views
2
Comments
Adding Comma on Expression under Condition
Question
Application Type
Reactive
Service Studio Version
11.53.8 (Build 60969)

Good Day Community,

I have a table similar to the one above. The objective is to display messages based on the checked Flagged in an expression. Note that there is more than 3 flags but for the sake of presentation I only showed 3. 

The expression I currently have is

If(GetFlags.List.Current.Flags.isRedFlagged,

    "Red Error","") + ", "

If(GetFlags.List.Current.Flags.isBlueFlagged,

    "Blue Error","") + ", "

If(GetFlags.List.Current.Flags.isOrangeFlagged,

    "Orange Error","") + ", "

(and the expression continues by the way)

Results obtained

(R,B checked) Red Error, Blue Error, 

(R checked) Red Error,

The issue is the comma. I wanted to condition it to only appear when it is necessary (if there is a word after). 

Any tips will highly be appreciated.


Regards,

Pens







2026-02-26 06-29-24
Rahul
 
MVP

Hi,

In your case you can not use replace function so use this expression -


If(GetFlags.List.Current.Flags.isRedFlagged,


    "Red Error","") + If(GetFlags.List.Current.Flags.isRedFlagged,", ","") +


If(GetFlags.List.Current.Flags.isBlueFlagged,


    "Blue Error","") + If(GetFlags.List.Current.Flags.isBlueFlagged,", ","") +


If(GetFlags.List.Current.Flags.isOrangeFlagged,


    "Orange Error","") + If(GetFlags.List.Current.Flags.isOrangeFlagged,", ","") +



You need to check condition for commas as well.


Hope this will help you.


2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi Pens,

here's an option : have a separate assignment for each checkbox, one after the other, adding a comma in front of the next color only if there is already something before, each goes like this :

result =

result + If ( GetFlags.List.Current.Flags.isFlagged , If ( result<>"", ", ", "" ) + " Error", "")

Dorine

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.