Hi all,
My first post here, so please be gentle
I’m trying to execute a command in System Execute that references a value that I pass in from a Data Reader, but everything I’ve tried doesn’t work.
I’ve made sure that I have set the input passthrough port, but nothing seems to work and I’ve tried all variations of syntax without any luck.
Any thoughts?
Thanks!
Hi daitienshi,
please see attachment. Basically it work as this:
* all records sent to SystemExecute are collected
* then serialized into string and used as STDIN for your command
* if you need to handle dynamic parameters for your executables, you need to prepare bash script, which reads STDIN and convert it into parameters
In exaple graph is first branch for unix and second for windows.
Hi Jarek,
Thanks for your quick reply.
Forgive me as I’m fairly new to this.
My data only has a single row and what I’m trying to do is extract specific fields in that record to feed into a command in my system execute.
Going through your example, I’m not quite sure how I would reference multiple fields from the input. How would I convert the STDIN into parameters, as you mentioned?
Also, when running your graph, the echo statement is not displayed in the console so I can’t see that it’s referencing the input value during the execution.
Thanks again for your help.
Chris
Never mind.
I just did some more research into command line scripting and figured it out.
Thanks for all of your help!
Chris
Just some notes for future generations
* code in sample can be used also for one row - the for/while cycle will be executed just once
* in loop variable you can find whole line, delimited by character from metadata (e.g. “a|b|c”)
* you need to parse it to get fields
also:
* output of echo commands in not visible in console because it is collected on output port of SystemExec component