on 2024 Nov 15 8:08 AM
Hi experts,
For my time and attendance report and i have a dimension for userId and another dimension for department name. i want to filter the story or page by the logged in userId department.
i got the logged in user in a variable called loggedInUser.
var loggedInUser = Application.getUserInfo().displayName;
Any idea how to achieve this ?
A.K
Request clarification before answering.
Hi A.K,
One easy way to achieve this is
1.Created a hidden table which filtered based on user logged in i got from your script function
var loggedInUser = Application.getUserInfo().displayName;
Once this hidden table is filtered you will get 'Department' member which he belongs with this function
var rslt =tab_hidden.getDataSource().getResultSet();
var dept=rslt[0]["Dept"].id;
2.Cretae a input control to filter all relevant widgets in your story with below function
IC_1.getInputControlDataSource().setSelectedMembers(dept);
With this it will filter the story with dept that user is logged in.
There are other ways too but i feel this is easy and simple to restrict widgets in story with the required department.
Thanks,
Venkat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is the simple csv model i used
and this is the script:
var loggeduserx = Application.getUserInfo().displayName;
Table_3.getDataSource().setDimensionFilter("UserID",loggeduserx);
var tb3rslt =Table_3.getDataSource().getResultSet();
var deptName = tb3rslt[0]["DepartmentName"].id;
InputControl_2.getInputControlDataSource().setSelectedMembers(deptName);
same error, I am getting this error specifically when i add this line:
var deptName = tb3rslt[0]["DepartmentName"].id;
I am going to accept the original solution as it works with another model.
If you care and have free time, then you can help me with this issue and let me know what other ways can be done in SAC to achieve this.
Thank you
User | Count |
---|---|
41 | |
15 | |
11 | |
9 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.