


Hello:
What I am trying to do is to add additional data to a query result(any data source including file import as well) using javascript, but I can't seem to find the solution for it.
For example:
Step1. Query a table "source", then I got some data back
Step2. using javascript to add another column to the result, say "newColumn" with value "aValue"
I could achieve this by create additional data through enrichment, then set the value to be empty, and then in javascript, i simply do a sql update with the id. This works perfectly fine, however, in our case, this value should be populated dynamically, and we don't want to create this "dummy" column manually in enrichment everytime.
I have tried using alter the temp table by using "alter tempTable add newColumn NUMBER(10)" in javascript, the execution does not throw any error, however, the "newColumn" is not available in the output(by clicking the "display the target"). I think I need to probably modify the schema in order for it to be available through "targetData"
Any ideas?
Thanks
Hello chiding,
you can use exclusion as intersection with any made up columns you want (intersection and union will error if you do not use database tables)
Use in exclusion set Joins and select fields you want to reconcile on
Hope this helps,
Marcel
Thanks for the reply, this will work, however i am looking for a more generic solution.
Say i have following example:
query from database or file import or any other data importing will get me following data
col1 | col2 | col3
--------------------------------------
value1 | value2 | value3
value1 | value2 | value3
then i want to run a javascript, and make the output data like below:
col1 | col2 | col3 | col4 | col5 |.... col_N
----------------------------------------------------------------------
value1 | value2 | value3 | value4 | value5 | ............
value1 | value2 | value3 | Value4 | value5 | ...........
The reason is I want to make this javascript as a function so that any workflow can use.
One of my use case is the input data might contains xml/json, i want to dynamically parse it and flatten all the nodes/variables to a single column to the output schema.
Thanks