Currently, I’m doing the reporting in perspective which I will show the report in report viewer. In this case, I actually want to put the current user in the report module which I will get the current user that login in the session and put in the reports. May I know it is possible.
The best way I think of doing this is create a new parameters and get the current user in the parameters but when I do this it dint work. May I know anyone do this before.
That looks correct, but I suspect no user is logged in. Does your project require authentication? If not, you might want to look into at least requiring a user log in before accessing the View which contains the Report.
Hi @cmallonee, Image attached is the code that I write and the error message that prompt up. May I know what solution I should do to solve these problems.
Ah, the Report itself has no concept of a session. You will be unable to supply a default value which is a username. Perspective should supply the username as a param of the property. I have verified this does indeed work.
The report should be set up just like you have it, but supply a placeholder string in the expression. In my example I supply a value of “Fake”. My username variable is just userName, but the name does not matter. Your Perspective Report component should supply a case-specific param, and you should bind that param to the session property we mentioned previously.
Report Configuration:
Perspective component configuration (you can see in the background that the report is using “admin” as the username because the admin user is logged into the Designer):