Query to get admin and grand father

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
mpol_ch
User
Posts: 877
Location: Switzerland

Query to get admin and grand father

Post by mpol_ch »

Hello
I am using the following query to get the son and father records. But I would like also to have all records for admin (-1) and the records of grand father. Is there to improve the query to get the results?

Select * FROM events WHERE (User = $my_current_user_id) OR (User IN (SELECT Id FROM mitarbeiter WHERE Reportsto = $my_current_user_id))"

thanks
mpol_ch


mobhar
User
Posts: 11735

Post by mobhar »

You may use "UserID_Loading" and/or "UserID_Loaded" server event to add or change the User ID to the current logged in user, so he/she will be able access the records that belong to the other users.

Read "Server Events and Client Scripts" in the PHPMaker help file for more information and example.


scs
User
Posts: 694

Post by scs »

Maybe you can try on RecordSet_Selecting(&$filter).

No filter for administrator (-1), otherwise set the filter base on your requirements.


mpol_ch
User
Posts: 877
Location: Switzerland

Post by mpol_ch »

Thanks for the information. I am using this in "Custom File". Will it work also in custom file?

thanks
mpol_ch


mobhar
User
Posts: 11735

Post by mobhar »

"UserID_Loading" and "UserID_Loaded" server events are implemented in Custom Files, but not with "RecordSet_Selecting" server event.


Post Reply