Skip to content

Commit

Permalink
Merge pull request #6 from suranofsky/temp-v13
Browse files Browse the repository at this point in the history
When a field does not exist, should act like a no-match.
  • Loading branch information
mis306lu authored Jun 13, 2020
2 parents 1a8025f + 4c9ee9c commit b537144
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions Code.gs
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,28 @@ function startLookup(form) {
//ui.alert("GETTING THE DATA FIELDS FOR " + field);
var dataField = getDataField(dataFields,field); //040
//ui.alert(dataField);
if (dataField == null) continue;
var subfields = dataField.getChildren("subfield",slimNsp);
//ui.alert(subfields);
var valueExists = 0;
if (subField != null && subField != "") {
//RETURNS A '1' IF THERE IS NO MATCH
//RETURNS A '0' IF THERE IS A MATCH
var valueExists = doesSubFieldContainWithin(subfields,desiredValue,subField);
if (dataField == null) {
//IF THE FIELD IT'S LOOKING FOR
//DOESN'T EXIST IN THE RECORD, IT SHOULD COUNT AS
//AS A 'NO MATCH'
var valueExists = 1;
}
else {
//RETURNS A '1' IF THERE IS NO MATCH
//RETURNS A '0' IF THERE IS A MATCH
var valueExists = doesSubFieldContain(subfields,desiredValue);
}
var subfields = dataField.getChildren("subfield",slimNsp);
//ui.alert(subfields);

if (subField != null && subField != "") {
//RETURNS A '1' IF THERE IS NO MATCH
//RETURNS A '0' IF THERE IS A MATCH
var valueExists = doesSubFieldContainWithin(subfields,desiredValue,subField);
}
else {
//RETURNS A '1' IF THERE IS NO MATCH
//RETURNS A '0' IF THERE IS A MATCH
var valueExists = doesSubFieldContain(subfields,desiredValue);
}
}
matchedTheCriteria = matchedTheCriteria + valueExists;
//ui.alert("matched the criteria: " + matchedTheCriteria + " / " + desiredValue + "/" + subField);

Expand Down

0 comments on commit b537144

Please sign in to comment.