g3w-suite / g3w-admin

Server module for G3W-SUITE
https://g3w-suite.readthedocs.io/en/latest/g3wsuite_administration.html
Mozilla Public License 2.0
39 stars 30 forks source link

Internal Server Error: when using QueryBuilder `IN` / `NOT IN` clauses #874

Closed Raruto closed 3 weeks ago

Raruto commented 3 weeks ago

Checklist

Subject of the issue

IN and NOT IN clauses appear to be unsupported, same behavior also with v37.

Steps to reproduce

POST: {"field":"name NOT|IN|('Blue%20Palace')","formatter":1}

image

POST: {"field":"name|IN|('Blue%20Palace')","formatter":1}

image

Environment

[g3wsdk.info]

Link to your project

https://v36.g3wsuite.it/vector/api/data/qdjango/97/buildings_2f43dc1d_6725_42d2_a09b_dd446220104a/

Additional info

No response

wlorenzetti commented 3 weeks ago

@Raruto following the comparators available:

COMPARATORS_MAP = {
        'eq': '=',
        'gt': '>',
        'lt': '<',
        'ltgt': '<>',
        'gte': '>=',
        'lte': '<=',
        'like': 'LIKE',
        'ilike': 'ILIKE',
        'in': 'IN'
    }

So per IN try with in (lowercase)

NOT IN it desn't exist, I'll try to add.

Raruto commented 3 weeks ago

So per IN try with in (lowercase)

@wlorenzetti If feasable, please also add support for case-insensitive operators (http client-side code is not very clear in here).


How it should work in case of multiple values?

OK:

https://v37.g3wsuite.it/vector/api/data/qdjango/97/buildings_2f43dc1d_6725_42d2_a09b_dd446220104a/?field=name|in|('Blue%20Palace')&formatter=1

KO: Invalid field string supplied for parameter field

https://v37.g3wsuite.it/vector/api/data/qdjango/97/buildings_2f43dc1d_6725_42d2_a09b_dd446220104a/?field=name|in|('Blue%20Palace','Ice%20Palace')&formatter=1