Skip to main content

I have a batch file (.bat) that I need to run. What Transformers would I need to use to get this to run using a workspace in FME Desktop?

You can use the SystemCaller to do this. It can be initiated by anything. If you don't have anything to initiate it, you can always use a Creator to initiate it.


Using the SystemCaller, in what situations do I need to specify an Exit Attribute? is there a list of commonly used Exit Attributes and what they are used for?

 


Using the SystemCaller, in what situations do I need to specify an Exit Attribute? is there a list of commonly used Exit Attributes and what they are used for?

 

You can use it to check if the script did run successfully. From the help:

 

If an Exit Code Attribute is specified, it will be set to the executed program's exit code: usually 0 for success and nonzero for failure.


Thanks, this is super helpful.

One last question, which I am sure is an easy answer, my workspace to run the batch file includes the Transformers, I have not run it yet, but I have CREATOR --> SYSTEMCALLER --> ??? what Transformer would you recommend I include after SYSTEMCALLER? This would be my last Transformer in the workspace. My goal is to just have the .bat file run. I am thinking of using the Logger Transformer?


Thanks, this is super helpful.

One last question, which I am sure is an easy answer, my workspace to run the batch file includes the Transformers, I have not run it yet, but I have CREATOR --> SYSTEMCALLER --> ??? what Transformer would you recommend I include after SYSTEMCALLER? This would be my last Transformer in the workspace. My goal is to just have the .bat file run. I am thinking of using the Logger Transformer?

You could just leave it with the two transformers, but a better approach might be to include some error capture.

 

for example, the SystemCaller caller might successfully call the .bat file, but the .bat file fails to run and you get a nonzero exit code. Your workbench will show as having run successfully (because fundiemntally it did). What you could include is a Tester that tests for a 0 exit code and passes that to a logger which says 'Success'. Is cases where the exit code isn't 0, you can then pass it to a Terminator which will terminate the workbench, showing as a failure


You could just leave it with the two transformers, but a better approach might be to include some error capture.

 

for example, the SystemCaller caller might successfully call the .bat file, but the .bat file fails to run and you get a nonzero exit code. Your workbench will show as having run successfully (because fundiemntally it did). What you could include is a Tester that tests for a 0 exit code and passes that to a logger which says 'Success'. Is cases where the exit code isn't 0, you can then pass it to a Terminator which will terminate the workbench, showing as a failure

Yes 100% this is the best workflow here

Creator > SytemCaller > Tester (_exit=0) > (Logger pass|Terminator fail)


Reply