Expand my Community achievements bar.

SOLVED

Calculated field text question

Avatar

Level 2

Hi, I'm creating an automated tagging process based on criteria users select when submitting fields.  The problem is that the instructions IF(CONTAINS( .... is too broad. When someone selects Wholesale and Retail Brokers,for example,  WF delivers both abbreviations WBC_and WB, and it should only deliver WBC_   I need to change the code to include one of the fields, but to exclude a similar field 
IF(CONTAINS("All Brokers", {DE:CS - GRS Audience}),"ALL_"),
IF(CONTAINS("Customers", {DE:CS - GRS Audience}),"CUST_"),
IF(CONTAINS("Internal", {DE:CS - GRS Audience}),"INT_"),
IF(CONTAINS("Retail Broker", {DE:CS - GRS Audience}),"RB_"),
IF(CONTAINS("Retail Broker and Customer", {DE:CS - GRS Audience}),"RBC_"),
IF(CONTAINS("Wholesale and Retail Brokers", {DE:CS - GRS Audience}),"WBC_"),
IF(CONTAINS("Wholesale Broker", {DE:CS - GRS Audience}),"WB_"),

 

I'd appreciate any help you can provide.  Thank you! 

Peggy 

1 Accepted Solution

Avatar

Correct answer by
Level 2

Thank you, I did suggest the alternative code to the WF consultant, but he explained that he didn't think that would work.  He had a reason but I don't want to try to explain it here in case I get it wrong.   I may go back and double check though.  His recommendation was a nested If statement using this as an example. Replace the two lines with the retail broker to this:

IF(CONTAINS("Retail Broker and Customer", {DE:CS - GRS Audience}),"RBC_", IF(CONTAINS("Retail Broker", {DE:CS - GRS Audience}),"RB_")), 

 

which I couldn't get to work correctly each time so in the end I slightly edited the name of the fields to eliminate any duplicate words.  Even changing the casing was a small enough change to solve my problem. 

 

Thanks for your input. 

 

Peggy  

View solution in original post

2 Replies

Avatar

Level 4

If all the options are exactly as shown I would advise you to trade in a condition operator for your “contains”. See this link for more details.

 

https://experienceleague.adobe.com/en/docs/workfront/using/reporting/reports/calculated-custom-data/...

 

Something like IF({DE:CS - GRS Audience}="Retail Broker", "RB_", … might have worked better. 

Your other option would be to make the retail broker option more unique, e.g. “Retail broker only”.

 

Avatar

Correct answer by
Level 2

Thank you, I did suggest the alternative code to the WF consultant, but he explained that he didn't think that would work.  He had a reason but I don't want to try to explain it here in case I get it wrong.   I may go back and double check though.  His recommendation was a nested If statement using this as an example. Replace the two lines with the retail broker to this:

IF(CONTAINS("Retail Broker and Customer", {DE:CS - GRS Audience}),"RBC_", IF(CONTAINS("Retail Broker", {DE:CS - GRS Audience}),"RB_")), 

 

which I couldn't get to work correctly each time so in the end I slightly edited the name of the fields to eliminate any duplicate words.  Even changing the casing was a small enough change to solve my problem. 

 

Thanks for your input. 

 

Peggy