Skip to main content
Solved

current user

  • October 30, 2020
  • 1 reply
  • 106 views

Forum|alt.badge.img+5

I want to filter records based on the user that is currently logged into the application.

This should be possible as there are a lot of prefilters for My Projects and such, but can't seem to find out how to do this.

So how do I know what the current user is? And how do I use this in prefilters and views?

Best answer by Mark Jongeling

Hi Roy,

In the project I work on we use the function dbo.tsf_user(). This will return the current user his login name. If you would save these login names inside an employee table for example, you can use this inside your application for a variety of things, such as filtering records.

More on it here: https://docs.thinkwisesoftware.com/docs/kb/username.html

You can then use it in code to retrieve the unique employee id to use in other areas inside your application. Example code:

select p.project_name
  from project p
 where exists (select 1
                 from employee e
                where e.employee_id = p.project_leader_id 
                  and e.login_name = dbo.tsf_user()
              )

This would then retrieve all project names where the project leader is the logged in user. 

Hope this helps you out!

Kind regards,
Mark Jongeling

View original
This topic has been closed for comments

Mark Jongeling
Administrator
Forum|alt.badge.img+23

Hi Roy,

In the project I work on we use the function dbo.tsf_user(). This will return the current user his login name. If you would save these login names inside an employee table for example, you can use this inside your application for a variety of things, such as filtering records.

More on it here: https://docs.thinkwisesoftware.com/docs/kb/username.html

You can then use it in code to retrieve the unique employee id to use in other areas inside your application. Example code:

select p.project_name
  from project p
 where exists (select 1
                 from employee e
                where e.employee_id = p.project_leader_id 
                  and e.login_name = dbo.tsf_user()
              )

This would then retrieve all project names where the project leader is the logged in user. 

Hope this helps you out!

Kind regards,
Mark Jongeling


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings