Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Commit

Permalink
Add additional arguments to construct valid query strings
Browse files Browse the repository at this point in the history
  • Loading branch information
James Christie committed Jan 23, 2013
1 parent 7c9ae18 commit 110b741
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/restlets/rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,21 @@ function performSearch(recordType, batchSize, lowerBound, rawFilters, rawColumns
rawFilters[filter]['operator'],
rawFilters[filter]['value']);
if(rawFilters[filter].hasOwnProperty('formula')) {
valueList = rawFilters[filter]['formula']['values']
operator = rawFilters[filter]['formula']['operator']
fieldName = rawFilters[filter]['formula']['field']
valueList = rawFilters[filter]['formula']['values']
comparison = rawFilters[filter]['formula']['comparison']
joinOperator = rawFilters[filter]['formula']['join_operator']
conditions = [];

formulaString = "CASE WHEN (";
formulaString += valueList.join(operator)
for(index in valueList) {
conditions.push("{" + fieldName + "} " + comparison + " '" + valueList[index] + "'");
}
formulaString += conditions.join(' ' + joinOperator + ' ');
formulaString += ") THEN 1 ELSE 0 END"

// return([[formulaString], 0]);

searchFilters[searchFilters.length-1].setFormula(formulaString);
}
}
Expand Down

0 comments on commit 110b741

Please sign in to comment.