Kristi Carter Posted March 16, 2021 Share Posted March 16, 2021 I am working on a dashboard or even just one report and I would like the results to show based on the &FOCSECUSER. This is not an issue at this level however I would like to take it one step further and depending on the &FOCSECUSER and if they are a Security Level of Manager, I want them to see the data for all users. In theory this type of logic: WHERE WF_USER_ID EQ (IF WF_USER_ID EQ &FOCSECUSER AND SECURITY LEVEL EQ Employee THEN & FOCSECUSER ELSE _FOC_NULL); I have a table to reference that tells me who the manager is. See sample below: So with the example above my fex file lists out the hours for each User ID, when userid1 runs the report I want them to only see their data, when userid2 runs the report I want them to list all users in the data. What I am doing is not working quite right, I am sure this can be done, I am just not able to come up with the right logic or steps to make this happen. Anyone have any suggestions Link to comment Share on other sites More sharing options...
Toby Mills Posted March 16, 2021 Share Posted March 16, 2021 Hi Kristi Seems like this might be a good time to look up how you could use DBA security to help you out. Check out how different example users get different answers (see the bottom of this): Using Global Amper Variables to Create Dynamic DBA Rules The idea would be to add the MFD_profile and DBA rules and then just hit the Master file to produce your report. Your Managers will get a less restricted list than users. Or at least this seems like a good idea. I have a lot of errands to run for the next few days - maybe this will give you some food for thought. Later! Toby Link to comment Share on other sites More sharing options...
David Beagan Posted March 16, 2021 Share Posted March 16, 2021 It sounds like you can accomplish this with a variable &USER_SEC that would have a value of _FOC_NULL when the user is a Manager, otherwise the value of &USER_SEC would be set to &FOCSECUSER. Then you could simply: WHERE WF_USER_ID EQ '&USER_SEC' I think you can set &USER_SEC like this (assuming SEC_TABLE is the master file for your Manager/Employee security table): TABLE FILE SEC_TABLE PRINT COMPUTE USER_SEC/A20V = IF SECURITY_LEVEL EQ 'Manager' THEN '_FOC'|'_NULL' ELSE WF_USER_ID; WHERE WF_USER_ID EQ '&FOCSECUSER' ON TABLE SET HOLDLIST PRINTONLY ON TABLE HOLD AS usersec END -RUN -SET &USER_SEC = ' '; -READFILE usersec Link to comment Share on other sites More sharing options...
Kristi Carter Posted March 16, 2021 Author Share Posted March 16, 2021 David, I am trying to incorporate your sample, which is what I am looking for, however now I am trying to take the results of what you show and use it as what I want to pass in another portion of the fex file. Below is my print screen. It is not working, what do I have wrong image.png1455639 17.4 KB I get this error when I run it: Link to comment Share on other sites More sharing options...
Kristi Carter Posted March 16, 2021 Author Share Posted March 16, 2021 Wait - I got it, I needed to add the .QUOTEDSTRING. I think it is working now. Thanks so much for the help and suggestions. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now