Hi guys,
I'm trying to perform some string manipulation on the result set of a previous query. I'm using an intermediary Javascript step to contain the logic.
var schemaName = vars.targetSchema.substr(vars.targetSchema.indexOf(":") + 1);
logInfo(schemaName);
var query = xtk.queryDef.create(
<queryDef schema={vars.targetSchema} operation="select">
<select>
<node expr="@id"/>
<node expr="@description"/>
</select>
</queryDef>
);
result = query.ExecuteQuery();
for each (var e in result) {
logInfo(e.@description + e.@id);
// manipulation and assignment logic goes here
// db update logic goes here
}
// better if the db update goes here and is batched
I'm able to retrieve the fields from the previous step and print the columns out. I'm also able to perform the manipulation required on the description field but I can't, for the life of me, figure out how to SET and UPDATE the field in question.
Should I use a separate sqlExec call using an update sql query as it iterates over each item? Feels a bit inefficient and 'baking' in the string values directly to the sql query seems wrong and dangerous...
Many thanks.
Cheers!
--Erik