5

I'm calling my workspace from the command line (either via Python or .NET to a system/os call). I'm parsing DWGs and pushing attributes to SQL Server in the workspace. Either the data validates in the workspace or it doesn't. I need to return a value of 'pass/fail' to my calling application from my workspace based on whether or not the data validated within the workspace. Is this possible?

5

Check the exit code from the program; eg echo %errorlevel%

If it is 0 then the workspace ran successfully.

In the workspace, when you locate bad data then terminate the translation with a Terminator transformer. That should change the exit code to be non-zero.

Hence a non-zero errorlevel denotes bad data.

NB Read this first on StackOverflow

Other methods to get that information out would be to write it to a file with the Textline writer, or an AttributeFileWriter transformer. Then you could write your own exit code according to the type of problem.

Yet another method might be to utilize a Python shutdown script in some way.

I think it really depends on what you plan to do with the pass/fail information, and how.

  • Thanks Mark. I think I'm going to (try to) create parameters to get the values I need returned, then use a Python shutdown script to get them and return them somehow. I might also try the AttributeFileWriter to keep track of some things along the way. – Chad Cooper Jan 22 '11 at 12:20
2

If you want more than a simple workspace pass/fail you could also parse the resulting FME log file. You can control the logfile location with the LOG_FILENAME command line option as described at http://fmepedia.safe.com/articles/FAQ/Batch-Processing-Method-2-Command-File#heading_toc_j_3 (LOG_FILENAME is not just for batch processing).

0

You should be able to use either

http://www.fmepedia.com/index.php/XQueryExtractor

or

http://www.fmepedia.com/index.php/Data_Validation_with_FME_Server

or both.

  • I'm using FME Desktop (should have noted that earlier). I don't really see how either of these can do what I need, honestly. – Chad Cooper Jan 18 '11 at 20:32
  • I have seen the capability to call values within a workspace from published parameters from another workspace. Are you trying to utilize values in a completely different application? – Brad Nesom Jan 18 '11 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.