How do I add a field to a temporary table in a workflow?
Hi
I have a simple query which returns 1 column
I want to take each value from that column, do some JS stuff to it, then keep the result for each row to use in later stages of the workflow (for filtering/splits/etc)
The below works to get me to the value I am looking for, but I am unsure how to write the result back into the table?
Any advice appreciated, cheers
Stephen
Object.defineProperty(String.prototype, 'hashCode', {
value: function() {
var hash = 0, i, chr;
for (i = 0; i < this.length; i++) {
chr = this.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0; // Convert to 32bit integer
}
return hash;
}
});
var query = xtk.queryDef.create(<queryDef schema="temp:query" operation="select"><select><node expr="pid"/></select></queryDef>);
var resultSet = query.ExecuteQuery();
for each(var row in resultSet) {
instance.vars.pid2 = Math.abs(row.pid.toString().hashCode())
logInfo(Math.abs(row.pid.toString().hashCode()))
};