Hi, does anyone have any examples of CASE() statements used in calculated fields on a custom form?
I am trying to use the following and while it doesn't say there are any errors, it also doesn't pull back any data!
I have 2 custom fields, one with a nested If statement and the other I am trying to set up with a Case statement.
DE:MA - Choose the region Calc2
Hello PoppyJennings,
the CASE() function in Workfront works different to the IF() function.
Just have a look here.
It is used with other expressions to choose a value from a list, based on an index number.
Example:
CASE(DAYOFWEEK({entryDate}),"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
Works best with other expressions that return a number, such as DAYOFWEEK, DAYOFMONTH, and MONTH.
Regards
Lars
Views
Replies
Total Likes
Thanks Lars,
I realise the IF function is different from the CASE function.
I have a version using the IF function that is working but as you can see it means I am using a lot of nested If statements which is not the cleanest way of writing it out and managing it. Instead, I want to write it as a Case function/statement as this would be the most appropriate and cleanest way of doing this.
What I have written above for the case statement in the calculated field box doesn't show any errors (it is accepted as correctly written by Workfront) and yet it does not return any data.
As you can see, the input for the case statement in my case will not be a number.
Instead it will be a text entry "en-gb"
In this case, the returned value should be "GB/"
In the Adobe docs it only give the example for when the input value is a number but this isn't my case. I assume there are a lot of other people that also want to use a case function with inputs other than a number?
Thanks
Views
Replies
Total Likes
Hi @PoppyJennings,
Since CASE will not work in this...case...(noting that that this documentation confirms it is intended to resolve against an index number)...
To avoid the nested IFs, I invite you to consider this alternative, which works with text and although longer, might be easier to maintain:
Regards,
Doug
Hi Doug,
Thanks for this. Are you saying Case functions in Workfront Calculated fields only accept numbers as an input?
Is that why you are saying mine won't work?
Thanks
Views
Replies
Total Likes
I am, @PoppyJennings, gently; and trying to soften the news by offering the CONCAT alternative.
Regards,
Doug
When I read the documentation for CASE() I was so disappointed that it was numerical index based. @Doug_Den_Hoed__AtAppStore I very much like your CONCAT() method, I will be stealing this and most likely in the future using it with your status history log :). Thanks!
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies