Monday, June 4, 2018

Einstein Analytics: Filter syntax

Filter Conditions in sfdcDigest

When you do not need to bring the whole data from a Salesforce object to Einstein Analytics (EA), you can filter the data when retrieving it in sfdcDigest.

With filter out unnecessary data flow to EA, this will help our dashboard builders do not need to keep filtering out certain unused data, such as inactive users for the User object. Filtering data also will increase performance on the Dataflow and consume less total of records stored in EA.

In this sample, I want to bring in all active users and not included Chatter users. So, there are 2 filters need to add in sfdcDigest:
- isActive = true
- userType = "Standard"

If you come from Salesforce background, you can simply enter isActive = true && userType = Standard, but this is different in EA. Until Summer '18 release, you need to manually enter this filter conditions in JSON format.

Add this filter in sfdcDigest under Filter Conditions:

If you see the first filter, isActive is a boolean field, so passing just true without "" will get an error when running the Dataflow, so we need to add "isQuoted": true, this is also applicable for a numeric and date field.

Let's see this in JSON Dataflow:

Another option is to use Complex Filter Conditions. For the same filter, you can simply enter this condition isActive = True and UserType = 'Standard'

Let's see this in JSON Dataflow:

Tips #1
If you have OR filter in the Complex Filter Conditions, you should add () around the syntax, otherwise, you will hit by an error when running the Dataflow,
example: (isActive = True OR UserType = 'Standard')

Tips #2
Never add Filter Conditions or Complex Filter Conditions if you enable data sync, otherwise, not all data will bring into Einstein Analytics.

Filter syntax in filter Transformation

Use this to filter out data that you do not want with filter node. So, if you have data sync enabled, instead of filter data in sfdcDigest, do the filtering in this filter node. You can use filter node as the Source for another filter node.

Equal - StageName:EQ:Closed Won
Equal - Opportunity.Partner_Type__c:EQ:Reseller
Range - EmployeeId:R:100:1000
Not Equal - RoleName:N:Manager
OR - Lead Status:EQ:Open|Contacted
AND - Lead Status:EQ:Qualified,Rating:EQ:Hot

From Spring '19 release, you can use SAQL as filter syntax, sample: (Amount > 0)  && (StageName != "Closed Lost")

Blog last updated: 4 Jan 2019


No comments:

Post a Comment

Page-level ad