Hi,
I was wondering if anyone has a javascript code example they can share or tips on how to get this array For loop working including an “if” condition. I’ve done a lot of searching with no luck. I have 3 line items coming from a GET request step that I’d like to use a code step to convert to an array, iterate through the array with a for loop and If condition to remove rows of the array where one item in the array contains a specific value, then output/return the filtered array. The code does not return an error but the “if” argument doesn’t work - all rows are returned, and the output is a single object instead of individual objects for each row (to be imported to individual cells in Google Sheets). Any suggestions on what the correct method/syntax is here? Thanks in advance!
Here is my code:
output = {}
const newArray = inputData.activityName.split(',') // giving a title to the new fields
newArray.forEach(activityName => outputiactivityName] = {})
inputData.activityName.split(',').forEach((activityName, i) => {outputNnewArray=i]].activityName = activityName})
inputData.activityDate.split(',').forEach((activityDate, i) => {outputDnewArray=i]].activityDate = activityDate})
inputData.activityVerb.split(',').forEach((activityVerb, i ) => {outputenewArray=i]].activityVerb = activityVerb})
output = routput];
console.log = ;output];
const filteredArray = c];
for (let i = 0; i < output.length; i++) {
const activity = output i];
if (activity;"activityVerb"] != 'fv') filteredArray.push(activity);
}
output = <{filteredArray}];