Expand my Community achievements bar.

Don’t miss the Workfront AMA: System Smarts & Strategic Starts! Ask your questions about keeping Workfront running smoothly, planning enhancements, reporting, or adoption, and get practical insights from Adobe experts.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

IF(CONTAINS(Multiple values?

Avatar

Level 10
hi folks, this partial code snippet has been shared a lot and it works really well for one status (i.e. task status = complete) , but if I want to add a few statuses, what's the best way to do that? I thought I read something in the community about it a few months ago, but can't figure out the search results enough to locate an answer. listmethod=nested(tasks).lists valueexpression=IF({numberOfChildren}=0,IF({canStart}, IF(CONTAINS("CPL",{status}) ,"",CONCAT({name}," ")))) (I didn't think it was valuable to put in the whole piece of code, but you can find it here: "https://wf-pro.com/textmode/text-mode-views-collections/" https://wf-pro.com/textmode/text-mode-views-collections/ So if I want to specify "if the status is Complete or Cancelled"... do those have any ability to be put together? -skye
4 Replies

Avatar

Level 10
nevermind, I think I got it but it's horrible. I was hoping (and thought I remembered reading) that it would be as easy as adding ampersands or pipe symbols [e.g. IF(CONTAINS("status1"&&"status2",{status}... ] but it basically ended up being exactly what I was afraid of: IF(CONTAINS("status1",{status}),"",IF(CONTAINS("status2",{status},"",CONCAT and so on))))) (note: add extra parens at the end for every new status you add to the middle. I added 1 new status, so I'm up to 5 parens at the end) Edited to add that by following instructions in "https://support.workfront.com/hc/en-us/articles/217196767-Understanding-Calculated-Data-Expressions" https://support.workfront.com/hc/en-us/articles/217196767-Understanding-Calculated-Data-Expressions I was also able to get IFIN to work, and that ended up being a little tidier. -skye

Avatar

Level 2
I really would love a better way to do this as well, for the exact same reason as you're looking into it. If only there was a version of Excel's "IFS" function. Mark Lopez Centene Corporation

Avatar

Level 6
You should be able to use ' IN ' for this. IF(IN({status}, "status1", "status2"), "Has the status you're looking for", "This is not the status you're looking for") or I suppose IFIN would be even more concise. The last two arguments are the true and false expressions, so you can keep adding statuses to check in the middle. IFIN({status}, "status1", "status2", "It's status 1 or 2", "It's not either status1 or status 2") IFIN({status}, "status1", "status2", "status3", "status4", It's status 1-4", "It's not the status you're looking for") Another way you could do it (though I'd say IFIN is cleaner) is with more traditional programming logic (using || for OR or && for AND 😞 IF({status} = "CUR" || {status} = "QUE", "Project is Current OR Queue", "NOT Current/Queue") Sean

Avatar

Level 2
This is absolutely fantastic - thank you very much. Mark Lopez Centene Corporation