I had an issue earlier and received some help with it earlier but now i'm having an issue updating/adding a link to earlier issue.
I have a slightly different setup at this point because i couldn't figure out how to update my data. At this point. I need to get the data from my Array A (filepath) into my list of objects as another property in my sub object with a key of "-i". I feel like i should be able to iterate through the array and add one of these values to my object but i've tried using the reduce and loop features but haven't been able to get my desired output, if there's a easier way from starting with my last post issue i'd be happy to go back to that state.
//Desired ouput
{
process0000x0000: {-i:"D:\\Code\\UnitTest\\Tests\\Run_01_TEMP\\0000x0000.png, tr: 16, tc: 16, ofr: 16, ofc: 16, outfile: 'D:\\Code\\Process\\1' },
process0000x0001: {-i:"D:\\Code\\UnitTest\\Tests\\Run_01_TEMP\\0000x0001.png", tr: 16, tc: 16, ofr: 16, ofc: 16, outfile: 'D:\\Code\\Process\\1' },
process0000x0002: {-i:"D:\\Code\\UnitTest\\Tests\\Run_01_TEMP\\0000x0002.png", tr: 16, tc: 16, ofr: 16, ofc: 16, outfile: 'D:\\Code\\Process\\1' }
}
//Array A
"outputParameters": [
{
"name": "0000x0000",
"filepath": "D:\\Code\\UnitTest\\Tests\\Run_01_TEMP\\0000x0000.png"
},
{
"name": "0000x0001",
"filepath": "D:\\Code\\UnitTest\\Tests\\Run_01_TEMP\\0000x0001.png"
},
{
"name": "0000x0002",
"filepath": "D:\\Code\\UnitTest\\Tests\\Run_01_TEMP\\0000x0002.png"
}]
// current output
{
process0000x0000: { tr: 16, tc: 16, ofr: 16, ofc: 16, outfile: 'D:\\Code\\Process\\1' },
process0000x0001: { tr: 16, tc: 16, ofr: 16, ofc: 16, outfile: 'D:\\Code\\Process\\1' },
process0000x0002: { tr: 16, tc: 16, ofr: 16, ofc: 16, outfile: 'D:\\Code\\Process\\1' }
}
UPDATE: so i added the below but i'm still receiving the last "filepath" for each entry in my consoleparamscompiled data. I tried your way and the way i have shown below but with the same results.
//results
},
process13x21: {
'-i': 'D:\\Code\\UnitTest\\ConsoleApp\\1\\13x23.png',
'-tr': 16,
'-tc': 16,
'-ofr': 16,
'-ofc': 16,
'-outfile': '"D:\\Code\\UnitTest\\ConsoleApp\\Process\\1"'
},
process13x22: {
'-i': 'D:\\Code\\UnitTest\\ConsoleApp\\1\\13x23.png',
'-tr': 16,
'-tc': 16,
'-ofr': 16,
'-ofc': 16,
'-outfile': '"D:\\Code\\UnitTest\\ConsoleApp\\Process\\1"'
},
process13x23: {
'-i': 'D:\\Code\\UnitTest\\ConsoleApp\\1\\13x23.png',
'-tr': 16,
'-tc': 16,
'-ofr': 16,
'-ofc': 16,
'-outfile': '"D:\\Code\\UnitTest\\ConsoleApp\\Process\\1"'
}
}
// ADDED CODE
// loop through each data we want to add and add a property.
` consoleOutputParamsOBJ.forEach((obj) => {
var processname = dynamicTaskNameBaseOBJ + obj.name;
console.log(processname);
//taskparamscompiled.processname['-i'] = obj.filepath;
taskparamscompiled[processname]['-i'] = obj.filepath;
// console.log(dynamicTaskNameBaseOBJ + obj.name);
});
console.log(taskparamscompiled);`