qgis / qwc2-demo-app

QWC2 demo application
Other
240 stars 149 forks source link

Comma separated values and Qgis search #545

Open cazitouni opened 2 months ago

cazitouni commented 2 months ago

Hello,

I got a question regarding Qgis search.

Using the following Qgis search config :

{"Arbre": "\"id_arbre\" IN ( '$TEXT$' ) "}

I am able to get an item using the id but not multiple using a comma separated string, for example if my input is 59 it'll return tree 59 but if my input if 58,59 it'll return nothing.

The string is passed as followed %2758,59%27, but in my usecase I would need %2758%27,%2759%27, thing is if I use the single quote directly in the text it'll be escaped in the url like %2758%5C%27,%2759%27.

I would like to know if there is a proper way to achieve my purpose or if I should jsut drop the idea ?

Thanks in advance for any answer, Kind regards, Clément.

manisandro commented 2 months ago

If they are just numbers, maybe

{"Arbre": "\"id_arbre\" IN ( $TEXT$ ) "}

works (i.e no single quotes). Otherwise, something like list($TEXT$) would need to be implemented.

cazitouni commented 2 months ago

Hello,

Yeah, unfortunately is the kind of ID who may have text in it. Another solution I was thinking of is adding others allowed tokens in Qgis Server then doing it in SQL but it seems a bit inadequate. Also I could try to make a custom search provider who handle that in JS, but It would have been way better to just use the Qgis search.

I'll look into it.