Calculated field text question | Community
Skip to main content
May 10, 2024
Solved

Calculated field text question

  • May 10, 2024
  • 1 reply
  • 595 views

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 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by PHenn

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  

1 reply

skyehansen
Community Advisor
Community Advisor
May 11, 2024

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/condition-operators-calculated-custom-expressions

 

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”.

 

PHennAuthorAccepted solution
May 13, 2024

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