Ok. Here we are with this one. I have the entire flow working as it should, all the way until the last part. Where I take a table scraped off a website, thats imported into a new workbook sheet. We will call this Sheet WebData. I have PAD analyze column 3, "Responses" which contains a number. 001, 002, 004, 006, 009, 999. 001 and 002 are "Good", 004 needs to return a value of "LocCoord", 006 as "HiFacility", 009 as "Unkn", and 999 as Late. There could possible be up to 20 of these per table.
I've tried using If statements, nested IF's, Else-If, Switch functions....not wanting to play ball. Now I'm coding it out in Java. Have 2 scripts written that should work, but I cannot get the variables to pass Into or Out of the script.
I currently have the flow set up to both store that column as a list in say %Resp_List%, and as individual variables, say %ExcelData1% thru %ExcelData20%.
Stuck like chuck on this one. And I'm feeling as though it might be a limitation of the Conditionals in PAD even when combined with Logic statements as well.
Any help would be lovely!
JS:
" // Read Resp_List from Power Automate input
var Resp_List = %Resp_List%;
// Initialize ListOutput as "Empty" by default
let ListOutput: string = "";
{
// Check if Resp_List contains a 4
if (Resp_List.includes(4)) {
ListOutput = "LocCoord";
}
// Check if Resp_List contains a 6
else if (Resp_List.includes(6)) {
ListOutput = "HiFacility";
}
// Check if Resp_List contains 999
else if (Resp_List.includes(999)) {
ListOutput = "LATE";
}
// Check if all values in Resp_List are either 1 or 2
else if (Resp_List.every(val => val === 1 || val === 2)) {
ListOutput = "Good";
}
// Output ListOutput as the final result
//ListOutput = %ListOutput%;
var ListOutput = %ListOutput%;
WScript.Echo(ListOutput);
}"