Skip to main content
Solved

user parameter within sql statement

  • November 10, 2022
  • 5 replies
  • 351 views

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

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

 

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.

5 replies

david_r
Celebrity
  • 8391 replies
  • 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+60
  • 2938 replies
  • November 10, 2022

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
  • 8391 replies
  • November 10, 2022

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
Supporter
Forum|alt.badge.img+38
  • Supporter
  • 592 replies
  • 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
  • 43 replies
  • 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