Here is a sample of the Javascript, that I want to add an additional WHERE statement to the CONDITIONS variable.
In addition to Where Cost > 0, only include records where ProductName begins with "XYZ".
Maybe: AND ProductName StartsWith('XYZ') ??
REPORTS: [{NAME: 'MYREPORTNAME',
CONDITIONS: 'WHERE Cost > 0',
FIELDS: {'ProductSKU' : 'STRING',
'ProductName' : 'STRING',
'Cost' : 'FLOAT'
}
This is later called in this function:
function retrieveMyReport(reportConfig, ClientId) {
var fieldNames = Object.keys(reportConfig.FIELDS);
var report = MyApp.report(
'SELECT ' + fieldNames.join(',') +
' FROM ' + reportConfig.NAME + ' ' + reportConfig.CONDITIONS +
' DURING ' + CONFIG.DEFAULT_DATE_RANGE);
...
How do I expand this WHERE clause to include both conditions?
This looks like an SQL query, so you should probably use the LIKE operator:
CONDITIONS: 'WHERE Cost > 0 AND ProductName LIKE \'XYZ%\''