Calculation before pre-filter

woznyp

Member
Hi,

my problem for today:
I want to pre-filter one table by using value of one filed as calculation element ("dopobrania___groupcheck").
art1.png

Code in groupcheck:
art2.png

Current result on list:
art3.png

The idea is: for every user who can see this list, that user should see only records with group the same as his.
In db table there should be only one record with one file for one user group.

Calculation checks if user belongs to group from filed "dopobrania___grupa" and if true returns user_id.

I tried to user pre-filter on filed "dopobrania___groupcheck" as this:
art4.png
But it returns no records!

It doesn`t matter what is stored in db in "dopobrania___groupcheck" (can be NULL) because it should be re-calculated when list is loaded.
 
There is a "usergroup" element (in GitHub) that might do what you need: it displays the group(s) each user belongs to.
You can then pre-filter on this one to get what you need.
 
It should be possible to use
{$my->groups} (will return something like 8,9,15)
in the calc element and in the pre-filter directly
 
In calc elements {$my->groups} returns nothing.

In pre-filter I also get nothing.

I tried to return in "dopobrania___groupcheck": if true user_id, if false "NULL". But even in that case I cannot pre-filter my db with query like this:
where groupcheck equals "NULL" (text)

It should show every record with empty (false return), but it doesn`t work at all.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top