0

I have a json filter in lightning record page for a Analytics dashboard. There are conditions where Code1__c will be NULL or Code2__c will be NULL . Is there any mechanism in JSON filter where we can put OR condition to use Code__1 if Code2__c is NULL and viceversa. Currently dashboard is taking both the fields which is failing the dashboard to display data. Any ideas....

{ 
   'datasets':{ 
      'OpportunityProducts':[ 
         { 
            'fields':[ 
               'Opportunity.Account.Code1__c'
            ],
            'selection':[ 
               '$Code1__c'

            ],
            'filter':{ 
               'operator':'matches',
               'values':[ 
                  '$Code1__c'  
               ]
            }
         },
         { 
            'fields':[ 
            'Opportunity.Account.Code2__c'
            ],
            'selection':[ 
               '$Code2__c'
            ],
            'filter':{ 
               'operator':'matches',
               'values':[ 
                  '$Code2__c'
               ]
            }
         }
      ]
   }
}
0

You can use the formula editor in the compare table, or write the SAQL itself.

Both ways, you are going to use the coalesce function: coalesce(Code1__c, Code2__c)

However there are still certain situations to consider: Can only one of the values be filled? If so, the above code would be sufficient. If not, you have to decide if Code1__c or Code2__c should be displayed (That field has to be the first argument of the coalesce funtion).

Can both values be null? Should there be something in that field like a message "both values null" or an empty string? That has to be added as a third argument.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.