I am facing an issue with the currentBillCyclePath parameter in the following function. I need to use this parameter to filter out certain elements after executing the query.
However, inside the while loop, the value of currentBillCyclePath is undefined. The value is present at the beginning of the method but gets lost within the loop.
The requirement is to extract
listItemValues.FileRef.split("/")[4];
and check if it matches the currentBillCyclePath
, excluding it from the array if there's a match.
function GetRelatedBillingDocumentsFromList(selectProperties, currentBillCyclePath, clientCode, jobCodes, engagementCode, enhanceFunctions) {
// Code block goes here...
}
Update: Syntax error https://i.sstatic.net/LtTnZ.png
Update 2: Added GetData function
function GetData(billCyclePath, clientCode, jobCodes, engagementCode) {
// Code block goes here...
}
Update 1:
After debugging, I realized that the filter function was wrongly implemented. Despite using console.log statements to track the values, sometimes it returns true and other times false. Upon further inspection, the IF statement never executes the push, resulting in an empty array.
Here is my updated code snippet:
// Filtered list item values creation var createFilteredListItemsWithValues = createListItemValues( function(listItemValues) {
var x1=listItemValues && typeof listItemValues.FileRef === "string" && listItemValues.FileRef.split("/")[4];
var x2= currentBillCyclePath.split("/")[8]
console.log(x1===x2);
return !(listItemValues && typeof listItemValues.FileRef === "string" &&
listItemValues.FileRef.split("/")[4]) === currentBillCyclePath.split("/")[8];
}
);