hello
I use asp.net make 2021
and want to get data from table according to current user info such as (currentuserid()) and so on.
I try many time in filer editor/table option and no record output .
please am really need to help
Thanks
Show your table filter.
MichaelG wrote:
Show your table filter.
“Sub_dept_ID= CurrentUserID()”
or
“Sub_dept_ID= ‘CurrentUserID()’”
this the filter which has written in the table filter editor
Sub_dept_ID : is the field name (integer)when I use :
“Sub_dept_ID= ‘1’” will work fine because i put constant , but when use current user id or something else so nothing outputthank you dear
“Sub_dept_ID= CurrentUserID()”
or
"Sub_dept_ID= ‘CurrentUserID()’"this the filter which has written in the table filter editor
Sub_dept_ID : is the field name (integer)when I use :
“Sub_dept_ID= ‘1’” will work fine because i put constant , but when use current user id or something else so nothing outputthank you dear
You should concat the function as:“Sub_dept_ID= '” + CurrentUserID() + “'”
Thank you so much , its working
So If I want to add more than one filter ?
how can do that?
I mean two fields for two current user info with (or)Thanks
You should construct your SQL as:“Sub_dept_ID = '” + CurrentUserID() + "’ OR Sub_dept_ID = …"If … is a server side function, concat it similarly to CurrentUserID().
Thanks Dear
I have a related question and I am trying to filter the displayed dropdown value based on the user level
See my syntax below. Please recommend any edit as this is not working.If ‘" + CurrentUserLevel() + "’ = ‘4’
Then
“Request_Status IN (‘Pending Approval’,‘Submitted For Approval’,‘Cancelled’)”
ELSE If ‘" + CurrentUserLevel() + "’ = ‘5’
Then
“Request_Status IN (‘Submitted For Approval’,‘Released For Payment’,‘Cancelled’)”
ELSE
“Request_Status IN (‘Pending Approval’)”
Use the ?: syntax. For example:CurrentUserLevel() == 4 ? “filter1” : (CurrentUserLevel == 5 ? “filter2” : “filter3”)
I updated as instructed below
CurrentUserLevel() == 4 ? “Request_Status IN (‘Pending Approval’,‘Submitted For Approval’,‘Cancelled’)” : (CurrentUserLevel == 5 ? “Request_Status IN (‘Released For Payment’,‘Submitted For Approval’,‘Cancelled’)” : “Request_Status IN (‘Pending Approval’)”)and now I have the following errorsC:\inetpub\wwwroot\staging_publishing*\Models*View.cs(2220,46): error CS0019: Operator ‘==’ cannot be applied to operands of type ‘string’ and ‘int’ [C:\inetpub\wwwroot\staging_publishing**.csproj]
since ANM2021, CurrentUserLevel() returns a string.CurrentUserLevel() == “4” ? …