Skip to main content
Solved

user parameter within sql statement

  • November 10, 2022
  • 5 replies
  • 282 views

femo
Contributor
Forum|alt.badge.img+6
  • Contributor

Hi,

i read a postgis table with the feature reader. As a WHERE clause i want to filter on a certain criteria, say:

 

name_community IN ('Comm1','Comm2','Comm3')

 

I would like to allow multiple selection. Therfore I have choosen the type of parameter "choice" and a list with multiple selection. The name of the parameter is "_community".

 

Now , I thought:

 

name_community IN (%(_community))

 

However, this does not work. Any support would be appreciated.

Best answer by femo

Hi everybody,

 

thanks realy a lot for the imediate and valuable replies! They helped me a lot.

I finally managed it, maybe not in the smartest way, but it works:

imageBest wishes, Uwe

 

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

5 replies

david_r
Celebrity
  • November 10, 2022

It seems you're missing a dollar-sign to indicate the reference the parameter. Try something like

name_community IN ($(_community))

 


nielsgerrits
VIP
Forum|alt.badge.img+54

I did not test this but does it work when you create the where statement in an attribute with an attributecreator upstream of the featurereader and then refer to the attribute in the featurereader?


david_r
Celebrity
  • November 10, 2022
nielsgerrits wrote:

I did not test this but does it work when you create the where statement in an attribute with an attributecreator upstream of the featurereader and then refer to the attribute in the featurereader?

Agreed. Definitely what I'd do myself in this situation. So much easier to debug and control for edge cases.


lifalin2016
Contributor
Forum|alt.badge.img+29
  • Contributor
  • November 11, 2022

The query needs to have the correct syntax, so you need to generate a variable (_community_list) with a content of 'Comm1','Comm2','Comm3', and then use name_community in (@Value(_community_list)) in your query.

This can be done with an AttributeCreator and an Aggregator between two FeatureReader's.

Cheers


femo
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • Best Answer
  • November 11, 2022

Hi everybody,

 

thanks realy a lot for the imediate and valuable replies! They helped me a lot.

I finally managed it, maybe not in the smartest way, but it works:

imageBest wishes, Uwe

 


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