Filter query results based on user information

Filter query results based on user information

  
I am trying to filter table results based on specific information a user has entered.

I have user enter 5 zipcodes under 5 different attributes in the User_Master entity.  I have created a table that will display differenty address based on the zipcodes in the attributes.   The query is running the search and displaying the information as requested with one small error.  The table will display results from all users in the system.

For example:
User #1 inputs 22191, 22192, 22193, 22194, 22195
User #2 inputs 22025, 22026, 22027, 22028, 22029

The result should be that User #1 should only see addresses based on those zip codes but right now user #1 sees information for himself and user #2.  I know I need to tell the query to only filter the data for the logged in user but can't figure out how to do so.  Hopefully someone can point me in the right direction.

Hi Nourman, and welcome to the OutSystems community forums.

If I understood your problem correctly, you need to create an input parameter for the query of User Identifier data type (for example, name it "CurrentUserId").

You need to pass it Session.UserId, and then add a condition stating "USER_MASTER.Id = CurrentUserId".

Will that do the trick?

Regards,

Paulo Tavares
 Hi Nourman,

to get only the results from the logged user you should add an Input Parameter in your query and use the action Login_GetUserMasterId().




For more information check this http://www.outsystems.com/NetworkForums/ViewTopic.aspx?Topic=user-and-user_master---users-and-access-control-faq

regards,
Miguel Antunes

Thank you Paulo & Miguel.  Both of your suggestions worked flawlessly.  I knew it was a simple thing but just couldn't exactly put my finger on it.  Thanks again for your quick help and response!
Hi Nourman,

By all means, we're glad to help.

Let us know how it goes, and if something else comes up!

Regards,

Paulo Tavares