I have the following table:
Change_id
Title
Requester
Description
Aproval
Aproved_by
Notes
Multiple users are supposed to check each other work and the person who request a change, cannot approve it. So, I can’t use a filter under the “lookup table” section. I would like to apply the filter under the Recordset Selecting but it is not working as written.
Here is the code I am using:
function Recordset_Selecting(&$filter) {
if (CurrentPageID() == “edit”) {
AddFilter($filter, “Approved_by = '”.CurrentUserName().“'”);
}
}
Basically, the filter does not work and it show all users instead of the current user’s username only.
The usertable where the users come from is as follows:
Table Contacts
Here is the table structure:
Column Type Comment
EntID int(20)
ContID int(20) unsigned Auto Increment
First varchar(35)
MI varchar(3) NULL
Last varchar(35)
Position varchar(35) NULL
OfficeNo varchar(20)
Mobile varchar(20) NULL
Email varchar(50)
Profile text NULL
Username varchar(50)
Password varchar(500)
Group int(11) NULL
Here are some record examples (modified)
EntID ContID First MI Last Position OfficeNo Mobile Email Profile Username Password Group
1 6 Joshua P Hersho IT Security 555-555-5555 555-555-5556 elhersho@company.com hersho xxxxxxxxxxxxxxx -1
1 7 Noslen B Piedro IT Engineer 555-555-5557 555-555-5558 elhijo@company.com elhijo xxxxxxxxxxxxxxx -1
1 8 Agostin P Bobo IT Manager 555-555-5559 555-555-5550 elbobo@company.com bobol xxxxxxxxxxxxxxx -1
I think I have to use ContID somewhere as that is the key of the table for users but I don’t know how.
Help, as always, is appreciated!