Negative wildcard not working on tag entry with more than one tag
I have a field with tags (actually a field alias of type "tag", not sure if that's important): workarea_stafftags: foo, bar.
I can filter a datatable by filter: workarea=foo and I can filter by filter: workarea=bar. But filtering by either filter: workarea!~foo or filter: workarea!=foo does not work on entries which have more than one tag set (as in the example above).
It only filters out (correctly) entries which have either no "workarea" or only one other "workarea" than "foo" (e.g. workarea_stafftags: bar). But it does (incorrectly) show entries with "foo" as well whenever a second tag is present.
The multivalued entries are stored as separated key-value pairs in the data table.
A != or LIKE NOT are performed for each key-value pair, so that fails of course.
There misses something that checks all the values per page.
For filter: workarea!=foo
---- datatable ----
headers : ID, Data page, Price, Workarea
cols : id, %pageid%, price, workarea_stafftags
where : %class%=cloud_test
align : l, l, r
summarize : 1
filter: workarea!=foo
----
SELECT group_concat(" " || T1.value,''),
" " || pages.page,
group_concat(" " || T2.value,''),
group_concat(" " || T3.value,'')
FROM (
SELECT DISTINCT pages.pid AS pid
FROM pages
LEFT JOIN data AS T1
ON T1.pid = pages.pid
AND T1.key = 'workarea'
WHERE 1 = 1
AND pages.class = 'cloud_test'
AND T1.value != 'foo'
) AS W1
LEFT JOIN data AS T1 ON T1.pid = W1.pid AND T1.key = 'id'
LEFT JOIN data AS T2 ON T2.pid = W1.pid AND T2.key = 'price'
LEFT JOIN data AS T3 ON T3.pid = W1.pid AND T3.key = 'workarea'
LEFT JOIN pages ON W1.pid=pages.pid
GROUP BY W1.pid
ORDER BY 1 ASC
For filter: workarea!~foo it is a bit more detailed, but the issue is similar:
---- datatable ----
headers : ID, Data page, Price, Workarea
cols : id, %pageid%, price, workarea_stafftags
where : %class%=cloud_test
align : l, l, r
summarize : 1
filter: workarea!~foo
----
SELECT group_concat(" " || T1.value,''),
" " || pages.page,
group_concat(" " || T2.value,''),
group_concat(" " || T3.value,'')
FROM (
SELECT DISTINCT pages.pid AS pid
FROM pages LEFT JOIN data AS T1 ON T1.pid = pages.pid
AND T1.key = 'workarea'
WHERE 1 = 1
AND pages.class = 'cloud_test'
AND DATARESOLVE(T1.value,'workarea') NOT LIKE 'foo'
) AS W1
LEFT JOIN data AS T1 ON T1.pid = W1.pid AND T1.key = 'id'
LEFT JOIN data AS T2 ON T2.pid = W1.pid AND T2.key = 'price'
LEFT JOIN data AS T3 ON T3.pid = W1.pid AND T3.key = 'workarea'
LEFT JOIN pages ON W1.pid=pages.pid
GROUP BY W1.pid
ORDER BY 1 ASC