I am trying to remove dashes if an optional field is not filled out.
Here is my current formula:
CONCAT({DE:Region - Requesting Business Area},"-",{DE:Primary Requesting Business Area},"-", {DE:Secondary Business Focus},"-",RIGHT(YEAR({entryDate}),2),"-",{DE:Rally Feature Number},"-",{DE:TruBrand Family})
The first and third fields are optional (Region Requesting Business Area and Secondary Business Area) so I would like to remove the "-" if those fields are blank.
I've tried to use the If IsBlank formula a few different ways and have not been successful. Can anyone help? ty!
Here's my last attempt:
IF(ISBLANK({DE:Region - Requesting Business Area}," ","-",
IF(ISBLANK({DE:Primary Requesting Business Area}," ","-",
IF(ISBLANK({DE:Secondary Business Focus}," ","-",
CONCAT({DE:Region - Requesting Business Area},"-",{DE:Primary Requesting Business Area},"-", {DE:Secondary Business Focus},"-",RIGHT(YEAR({entryDate}),2),"-",{DE:Rally Feature Number},"-",{DE:TruBrand Family})))))))
Solved! Go to Solution.
Views
Replies
Total Likes
Hey @TCarey, give this a try:
displayname=My Calculated Field
textmode=true
valueexpression=CONCAT(IF(ISBLANK({DE:Region - Requesting Business Area}),"",CONCAT({DE:Region - Requesting Business Area}," - ")),{DE:Primary Requesting Business Area},IF(ISBLANK({DE:Secondary Business Focus}),"",CONCAT(" - ",{DE:Secondary Business Focus}))," - ",RIGHT(YEAR({entryDate}),2)," - ",{DE:Rally Feature Number}," - ",{DE:TruBrand Family})
valueformat=HTML
I often have trouble with ISBLANK depending on the type of field I'm using in the formula. What seems to work better for me is checking the length of the field. So something like:
IF(LEN({DE:Region - Requesting Business Area}>0,"-","")
So if there's any value in that field, it should get a -, otherwise it'll get nothing.
Views
Replies
Total Likes
thanks for your response! However, I still can't seem to get it to work. I'm sure it's how I'm phrasing it, I've tried a number of different ways and the system keeps highlighting IF LEN as errors.
Concat all the chosen fields. If the length of a chosen field is less than 0 characters do not use a dash.
CONCAT(IF(LEN({DE:Primary Requesting Business Area}>0,"-","",IF(LEN({DE:Secondary Business Focus}>0,"-","", RIGHT(YEAR({entryDate}),2),"-",{DE:Rally Feature Number},"-",{DE:TruBrand Family})))))
IF(LEN({DE:Primary Requesting Business Area}>0,"-",""+
IF(LEN({DE:Secondary Business Focus}>0,"-",""+RIGHT(YEAR({entryDate}),2),"-",{DE:Rally Feature Number},"-",{DE:TruBrand Family})))))
Views
Replies
Total Likes
Hey @TCarey, give this a try:
displayname=My Calculated Field
textmode=true
valueexpression=CONCAT(IF(ISBLANK({DE:Region - Requesting Business Area}),"",CONCAT({DE:Region - Requesting Business Area}," - ")),{DE:Primary Requesting Business Area},IF(ISBLANK({DE:Secondary Business Focus}),"",CONCAT(" - ",{DE:Secondary Business Focus}))," - ",RIGHT(YEAR({entryDate}),2)," - ",{DE:Rally Feature Number}," - ",{DE:TruBrand Family})
valueformat=HTML
Amazing! Thank you so much @J_Mas !
I had to tweak it a little bit - but it worked! Here's my final formula that I used in our custom form:
Views
Likes
Replies
Views
Likes
Replies