You are here:
Structured Filter in sfdcDigest Transformation
You define a structured filter using JSON syntax.
A structured filter uses the following JSON syntax for each filter condition.
{
"field": "<field name>",
"operator": "<operator>",
"value": "<value>"|"["<value 1>", "<value 2>"]",
"isQuoted": true|false}The value can be a number, date, string, list of strings, or date literal. CRM Analytics automatically
quotes strings unless you set isQuoted to true,
which indicates that the string is already quoted.
You can use one of the following operators in a filter condition.
| Operator | Comment |
|---|---|
| = | Filter condition is true if the value in the field equals the specified value. String comparisons using the equals operator are case-insensitive. Example: |
| != | Filter condition is true if the value in the field does not equal the specified value. Example (using backslashes to escape double quotes in a string value): |
| > | Filter condition is true if the value in the field is greater than the specified value. Example: |
| < | Filter condition is true if the value in the field is less than the specified value. Example (using a date literal): |
| >= | Filter condition is true if the value in the field is greater than or equal to the specified value. Example: |
| <= | Filter condition is true if the value in the field is less than or equal to the specified value. Example (using a SOQL function): |
| LIKE | Filter condition is true if the value in the field matches the specified value. The LIKE operator is similar to the LIKE operator in SQL; it provides a mechanism for matching partial text strings and supports wildcards.
Example: |
| IN | Filter condition is true if the value in the field equals any one of the values
in the specified list. You can specify a quoted or non-quoted list
of values. If the list is quoted, set Example: |
| NOT IN | Filter condition is true if the value in the field does not equal any of the values in the specified list. Example: |
| INCLUDES | For picklist or multi-select picklist fields only. Filter condition is true if the value in the picklist field includes the specified value. Example: |
| EXCLUDES | For picklist or multi-select picklist fields only. Filter condition is true if the value in the picklist field excludes the specified value. Example: |
Let’s look at a few examples of structured filters.
{
"Extract_Filtered_Opportunities": {
"action": "sfdcDigest",
"parameters": {
"object": "Opportunity",
"fields": [
{ "name": "Id" },
{ "name": "Name" },
{ "name": "AccountId" },
{ "name": "Amount" },
{ "name": "StageName" },
{ "name": "CloseDate" },
{ "name": "OwnerId" },
{ "name": "FiscalYear" },
{ "name": "FiscalQuarter" },
{ "name": "SystemModstamp" }
],
"filterConditions": [
{
"field": "FiscalYear",
"operator": "=",
"value": "2015"
},
{
"field": "FiscalQuarter",
"operator": "=",
"value": "2"
}
]
}
},
"Register_Opportunities_Dataset": {
"action": "sfdcRegister",
"parameters": {
"alias": "Opportunities_2015Q2",
"name": "Opportunities_2015Q2",
"source": "Extract_Filtered_Opportunities"
}
}
}{
"Extract_Opportunities": {
"action": "sfdcDigest",
"parameters": {
"object": "Opportunity",
"fields": [
{ "name": "Id" },
{ "name": "Name" },
{ "name": "AccountId" },
{ "name": "Amount" },
{ "name": "StageName" },
{ "name": "CloseDate" },
{ "name": "OwnerId" },
{ "name": "Probability" },
{ "name": "FiscalYear" },
{ "name": "FiscalQuarter" }
],
"filterConditions": [
{
"operator": "OR",
"conditions": [
{
"field": "StageName",
"operator": "=",
"value": "Closed Won"
},
{
"field": "Probability",
"operator": ">=",
"value": "90"
}
]
}
]
}
},
"Register_Opportunities_Dataset": {
"action": "sfdcRegister",
"parameters": {
"alias": "OpportunitiesExpectedToWin",
"name": "OpportunitiesExpectedToWin",
"source": "Extract_Opportunities"
}
}
}{
"Extract_Opportunities": {
"action": "sfdcDigest",
"parameters": {
"object": "Opportunity",
"fields": [
{ "name": "Id" },
{ "name": "Name" },
{ "name": "AccountId" },
{ "name": "Amount" },
{ "name": "StageName" },
{ "name": "CloseDate" },
{ "name": "OwnerId" },
{ "name": "FiscalYear" },
{ "name": "FiscalQuarter" }
],
"filterConditions": [
{
"operator": "AND",
"conditions": [
{
"field": "CloseDate",
"operator": "=",
"value": "THIS_FISCAL_QUARTER",
"isQuoted": false
},
{
"operator": "OR",
"conditions": [
{
"field": "OwnerId",
"operator": "=",
"value": "0056A0000020jzDQAQ"
},
{
"field": "OwnerId",
"operator": "=",
"value": "0056A0000020jzGQAQ"
}
]
}
]
}
]
}
},
"Register_Opportunities_Dataset": {
"action": "sfdcRegister",
"parameters": {
"alias": "DirectReport_Opportunities",
"name": "DirectReport_Opportunities",
"source": "Extract_Opportunities"
}
}
}
