Skip to main content
Solved

How can I configure the workspace to respond to invalid combinations of user parameter input with a costum error message in the log file?


I've created different user parameters for my workspace. Some specific combinations will lead to an error. The user has to choose the output format (Geotiff, JPEG or JPEG2000) and the color depth (Gray8, RGB24 or palette). JPEG and JPEG2000 don't support palettes, so those combinations will lead to an error. How can I configure the workspace to respond to invalid combinations of output format and color depth with a costum error message in the log file?

 

Thanks in advance!

Best answer by redgeographics

You can use a TestFilter to check the parameters and a Logger to write something to the log file.

 

If you set up your workspace with FeatureReader(s) instead of regular readers you can do that testing/logging beforehand and only trigger the FeatureReader(s) if the parameter settings are ok (trigger that TestFilter with a Creator)

View original
Did this help you find an answer to your question?

2 replies

redgeographics
Celebrity
Forum|alt.badge.img+48
  • Celebrity
  • Best Answer
  • December 5, 2022

You can use a TestFilter to check the parameters and a Logger to write something to the log file.

 

If you set up your workspace with FeatureReader(s) instead of regular readers you can do that testing/logging beforehand and only trigger the FeatureReader(s) if the parameter settings are ok (trigger that TestFilter with a Creator)


dustin
Influencer
Forum|alt.badge.img+30
  • Influencer
  • December 5, 2022

PythonCreator can be used also using the following code template. Workspace is attached for your reference.

        error = fmeobjects.FMELogFile().logMessageString("Invalid parameter combination")
 
        if FME_MacroValues['PARAMETER'] == "Geotiff":
            if FME_MacroValues['PARAMETER_2'] == "Gray8":
                return error
        elif FME_MacroValues['PARAMETER'] == "JPEG2000":
            if FME_MacroValues['PARAMETER_2'] == "RGB24":
                return error
        else:
            pass

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings