Page 1 of 1

Filter table not working

Posted: Thu Sep 12, 2013 3:26 pm
by thalassa3000

Hi,

I'am trying to filter a table or view based on the logged in user.

tblorders, contains orders that are assigned to a user. The current user only has to see the records that are assigned to him. The tblorders has a column userid for this.
tblusers, contains the userdata, with the id column as the id of the user
I used the advanced security, where I selected the tblusers and the id collum as userid

For this I use the record selecting event:

// Recordset Selecting event
function Recordset_Selecting(&$filter) {

ew_AddFilter($filter, "userID = '".CurrentUserID()."'");

When logged in as the user with the id = 1, no records show up. The tblorders does contains records with the userid = 1.

Please help me into the right direction. Thx!


Re: Filter table not working

Posted: Thu Sep 12, 2013 3:57 pm
by mobhar

How about this?

ew_AddFilter($filter, "userID = ".CurrentUserID()."");

Perhaps the userID is an integer field type, so, no need to quote the value?


Re: Filter table not working

Posted: Thu Sep 12, 2013 8:25 pm
by thalassa3000

Yep, that did the trick.

Thanks a million!