How do I add a field to a temporary table in a workflow?




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


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(



javascript table temporary workflow

Accepted Solutions (1)

Accepted Solutions (1)



Hi @stephenjwz Have a look into this sample code - it explains how to select some records, modify some values and then write back to the temporary schema:

If you have a lot of records i.e. > 10K, then you will need to page the record set select/write operations:

Note: if you need to do recordset paging, you cant write back to the temporary workflow schema - it wont work. It doesn't page correctly. You need to create a temporary schema and write back to that and then enrich the temporary schema back into the main schema later on.

Answers (1)

Answers (1)





I am not sure if you can do it directly in JavaScript..But when I do this kind of a "operation" i create all the fields i need in the enrichment activity beforehand where you fill the alias for easier selection in expression leave '' and then do the same thing you doing in JS



Also you can do by it executing SQL code in SQL activity or you could use JSAPI function sqlExec()  and altering the temporary table   'vars.tableName' by adding the columns you want.