top of page
OmniStudioFactBg.png
  • Writer's pictureGayathiri Mohan

How do you handle multiple filter conditions in DataRaptor Extract?

In this article, let's see how to handle multiple filter conditions using a DataRaptor Extract.


The below Filter combinations are possible based on the requirement :

  • Combination of AND and OR conditions

  • Multiple AND conditions

  • Multiple OR Conditions


Let’s see example scenarios for each of these Filter combinations.


Combination of ‘AND’ and ‘OR’ conditions:


Scenario: Fetch the ‘High’ and ‘Medium’ Priority Cases linked to an Account. 


With Apex code, we can get the result using the following SOQL query.

Select Id from Case where AccountId = '0015i00000gDYFHAA4' and Priority IN ('High', 'Medium') 

In DataRaptor Extract, we cannot use the IN operator and brackets (). So to accomplish this, we have to use the Filter conditions in the EXTRACT tab, as shown below.

Logically, the WHERE clause of the SOQL query will now appear as follows.

Select Id from Case WHERE (AccountId = '0015i00000gDYFHAA4' AND Priority = 'Medium') OR (AccountId = '0015i00000gDYFHAA4' AND Priority = 'High')

Then the required Case fields are mapped in the OUTPUT tab.

Output:

When we pass the ‘AccountId’ value and click ‘Execute’, we get all the ‘High’ and ‘Medium’ priority cases linked to that account.


Alternatively, we can first extract all the Cases linked to the Account from the EXTRACT tab.


Then in the FORMULAS tab, we can add a FILTER function, as shown below. 

This formula filters and returns only those Cases whose Priority value matches either the ‘High’ or ‘Medium’ value.


Now we can use the variable in the Formula Result Path to map to the Output fields in the OUTPUT tab to get the same result as the previous method.

Handling multiple AND or multiple OR conditions separately is pretty straightforward. Let’s have a look at them now.


Multiple ‘AND’ conditions:


Scenario: Fetch the Cases linked to an Account whose Priority is ‘High’ and whose Status is ‘Escalated’. 

Output:

Multiple ‘OR’ Conditions:


Scenario: Fetch all the Cases with any of the following Status values: ‘New’, ‘Working’, or ‘Escalated’.

Output:


References:


415 views1 comment

Recent Posts

See All

Edit Block in OmniScript

An Edit Block element in Omniscript allows the user to create, edit, and delete multiple records. To accomplish this, the edit blocks are...

OmniStudioFactFooterBg.png
logo.png

OmniStudiofacts helps us to build a Vlocity/OmniStudio Tech Community which focuses on sharing technical skills and experience across the globe.

© 2023 by OmniStudioFacts.

bottom of page