Hi Team
I have a requirement where I need to generate different update query statements for different tables depending on some conditions in a process model.Do we have any feature to implement this? I do not want to use a XOR gate and create different nodes from XOR condition as the query statements may be huge.Or if we can generate the query statement in a Script Task and directly call the query to update the tables in the process model.We use Appian version 21.1
Thank you!!
Discussion posts and replies are publicly visible
You can write an expression rule which creates a list of CDTs which can be inserts and updates based on input data.
Can you share a few more details?
Hi Stefan,My condition would be something similar in the rule expression : if (field 1 ="Test",
update table1 set table_col=ac!value where primarykey=ac!key,
if (field 1 ="Test1",
update table2 set table_col=ac!value where primarykey=ac!key,
null))table1 and table2 are two different tables with different structures.We may have more columns in set values and where clause
I'm not sure why you wouldn't have an XOR that routes the processing to the appropriate Write to Datastore node. If the tables are different with different structures then you gain no benefit from trying to unify them in any way. Treat them as distinct entities and route your process flow accordingly.
The Write to multiple Datastore Entities Node can update multiple tables in one go. Using a!entityData() you can create a list of items to be written to multiple tables.
Depending on your confidence in your Appian skills, the idea of Stewart Burchell might be a better option.