2

How can I make my user defined parameter (parameter is text, optional and published) work in a way so that if I provide a value, only that value is returned, but if I don't ALL of the records are returned?

my table

In other words: My parameter is based on field_3. What I want is that if I provide "b" only 2 features are returned but if I don't provide anything all 10 features are returned. At the moment if I don't provide any value, nothing is returned. I need something like if you leave the parameter blank to be ignored at all.

I am using FME 2021.

1
2

If I understand correct you want to test features on field_3 against a user parameter, if the attribute matches the user parameter let them pass and if the user parameter is empty, let them all pass.

The issue is you can't test if a user parameter does have a value. (This used to work but changed somewhere between 2016 and 2019.) So what you need to do is to create an attribute with the AttributeCreator based on the user parameter upstream of the tester.

UserParameter = $(UserParameter)

Then you can add these two rules to the tester.

NOT UserParameter Attribute Has a Value OR field_3 = UserParameter

Now, when $(UserParameter) is empty, all features will pass, when $(UserParameter) = field_3, those features will pass.

1
  • it works thank you. Great Idea
    – gisgis
    Jul 16 at 16:25
2

It depends on where you're using that parameter. Just setting up the parameter won't cause data to be filtered. You need to apply it somewhere. If you're getting no features at all, it's likely you have tested for parameter = X but need to add OR parameter = empty (as @nielsgettits mentioned).

The only thing I wanted to add is that if you're using a reader with a where clause, you could use the parameter in there to filter data directly. Performance-wise it's better than reading all of the data in a table and then testing what to keep.

1
  • thanks a lot I am going to check it as well...
    – gisgis
    Jul 16 at 16:24

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.