Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

API Search - OR logic

Avatar

Level 10
Hi, Within the Workfront user interface, when you create a report you can set filter logic using OR to combine two sets of criteria. e.g.: Criteria A + Criteria B OR Criteria C + Criteria D Using the API, I am not aware of any way to do this in a single query. I assume that I would need to run two queries separately then combine the results. Is this correct, or is there a way to include OR logic in a single query? Regards, David Cornwell
0 Replies

Avatar

Level 1
David yes, it is possible. just use. for example if you want to query based on several Owner you would use ...?ownerID=123&OR:a:ownerID=456&OR:b:ownerID:890 Idriss Bennis - Dream2Design Dream2Design

Avatar

Level 4
As Iddriss mentions, you use the OR:(1-999) syntax to create new combined or statements. For an example that matches a little closer your question about combining AND and OR statements, see the following: To get all projects where (Portfolio = HighGrowth AND Owner = Bob) OR (Portfolio = FixedAssets AND Owner = Bob) the syntax would be: portfolio:name=HighGrowth&owner:name=Bob& OR:1 :portfolio:name=FixedAssets& OR:1 :owner:name=Bob Note that by using the same digit in the OR (eg OR:1) you create an implicit AND statement between all the fields there. James Bender Jackson National

Avatar

Level 10
Thank you very much Idriss and James (your example matches what I want to do so that's a great help). @Michael Swan Not sure who to direct this to, so perhaps you can forward it on.....can you get the API Explorer documentation updated to cover the info James has provided? This would go in the GET Behaviour area, under Retrieving Objects. If this info was there I wouldn't have needed to ask the Community. Cheers "https://support.workfront.com/hc/en-us/articles/115003574147-API-Basics">https://support.workfront.com/hc/en-us/articles/115003574147-API-Basics David Cornwell

Avatar

Level 10
Indeed, David; valuable info worth sharing. Thanks, gents! @Luke Penrod , is this in your wheelhouse? Regards, Doug Doug Den Hoed - AtAppStore Got Skills? Lend a hand! https://community.workfront.com/participate/unanswered-threads

Avatar

Level 6
Just so you are all aware, we just published a new section in our basics document: "Using OR statements" https://support.workfront.com/hc/en-us/articles/115003574147-API-Basics Will Schmidt Workfront