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?

  • 4 December 2022
  • 2 replies
  • 1 view

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!

icon

Best answer by redgeographics 5 December 2022, 10:59

View original

2 replies

Userlevel 5
Badge +25

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)

Userlevel 3
Badge +26

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

 

Reply