I have a case.
user a can only access data a based on where = ‘a’,
user b accesses data with where = ‘b’.
whether it can be applied.
and what about the sample code to find the user who is logged in and apply select where = ‘a’ and jam?
can anyone help to catch the user and make a query on what server event?
thanks
newbiephp wrote:
where = ‘b’.
Please explain it in more detail for more discussion. A real example is better to explain.
Add this to Recordset_Selecting:
AddFilter($filter, “SOME_FIELD = '”.@CurrentUserName().“'”);
Don’t forget to change SOME_FIELD by the table’s field name you want to filter users by.
newbiephp wrote:
and what about the sample code to find the user who is logged in
You may simply checked by using the following code in any server event:
if (IsLoggedIn() && CurrentUserName() == “john”) { // check if already logged in, and make sure the username = john
// your code goes here …
}
how do i implement. my example will add data in the detail table and use the table car loockup. but in the look up I want to apply if login username () == ‘a’ then the filter in the car table uses the query select * from car where desc = ‘a’; , if you use logic like this, where should I write script?
and in the detail table when adding a master / detail is the maximum detail only 5 fields are displayed? the problem is I changed the field-> add page I removed the add check button or added the check in the generated field has not changed? are there any other settings? thanks (phpmaker 2019)
thank you
newbiephp wrote:
if you use logic like this, where should I write script?
Put it in “Lookup_Selecting” server event.
I also want to ask whether the create master details. from add master / detail.
add details follow from the list that is displayed in the field list page. tick the list? if so can the template custome write the appearance only specifically in the detail field. dalah this is not the same as the tabl page detail page list
Not sure what you are talking about.