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?

  • December 4, 2022
  • 2 replies
  • 12 views

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)

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

redgeographics
Celebrity
Forum|alt.badge.img+59
  • Celebrity
  • 3699 replies
  • 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+31
  • Influencer
  • 627 replies
  • 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