We now rewrote it as a NodeJS SwitchScript and it also works like a charm, but NOT when a parameter value for the script comes from a variable that fetches a value from a Database Connection like this:
Code: Select all
[Database.Text:SQL="SELECT #columnName FROM #tableName WHERE #columnValue = '[Job.PrivateData:Key="adID"]'",Connection="FileMaker-Database"]
The NodeJS SwitchScript fetches the parameters like this:
Code: Select all
tempKey = (await flowElement.getPropertyStringValue("key1")) as string;
tempValue = (await flowElement.getPropertyStringValue("value1")) as string;
Ofcource, when I view the value of exactly this variable within Switch it can be read from the database within a second, so I get the correct values. But the NodeJS script gets passed an empty string in all these cases. I assume that the NodeJS script does not await the final value, even though there are "awaits" right before the flowElement.getPropertyStringValue() calls.
I even forced the script to wait 20 seconds right at the start, but this didn't help either. (Wouldn't be a solution anyway, because I can't just make all jobs wait. But it was worth a test:
Code: Select all
import { setTimeout } from "timers/promises";
await setTimeout(20000);
await job.log(LogLevel.Info, "waited 20 seconds... maybe we get all database values now?");
Do I miss anything?
Can anybody give advice?
Thank you very much
Daniel