Hello,
I have created a “BATCH_ID” field for my data and assigned it using the method detailed here. Now I need to write this data to flat files in csv format.
However, I need to create the filename dynamically based on this BATCH_ID (something like _<BATCH_ID>.csv), and write each individual batch to a different file. I can hardcode the tablename, but see no way of getting the batch ID dynamically. Can someone please point me in the right direction?
I can of course load this data into a temporary staging table and then query it in a script, but I’d rather avoid doing this as:
- It increases the runtime of the job.
- I’d have to put the file write in a separate dataflow and loop it, generating the filename for each loop.
Both of the above are listed as bad practices in this thread.
EDIT:
Attempting to push that value into a global variable using a custom function is also not working. I’ve found several sources saying it is possible to set a global variable in a custom function call (such as this and this and this) but I see that the value is not persisting. I can see the value getting set in the custom function, but that value is not reflecting in the dataflow from where the custom function was called.
graghu1986 (BOB member since 2016-10-03)