Posted 7 May 2023, 7:00 pm EST
Is there a way to get a Local Storage Value to be used in the Json body?
Or What is the best way to run a dynamic query based on a users login. Eg. User 1 is from company X so only pull data for Company X.
Forums Home / ActiveReports / ActiveReportsJS
Posted by: bolsen on 7 May 2023, 7:00 pm EST
Posted 7 May 2023, 7:00 pm EST
Is there a way to get a Local Storage Value to be used in the Json body?
Or What is the best way to run a dynamic query based on a users login. Eg. User 1 is from company X so only pull data for Company X.
Posted 8 May 2023, 5:00 pm EST
Hi Brett,
>> Is there a way to get a Local Storage Value to be used in the JSON body?
For the ActiveReports JS end, The Report Definition is essentially a JSON resource and can modified just like any other JSON resource before passing it to the viewer. For your use case you can get values from the local storage and use it to modify the report json and then load it into the viewer.
For loading report as a JSON Resource please refer to the following pages of our documentation:
>> What is the best way to run a dynamic query based on a users login. Eg. User 1 is from company X so only pull data for Company X.
For this, instead of getting locally stored values I would highly suggest you to implement roll-based authentication and fetch the report definition with the modifications done pre hand from the server end based on user login and then use the above mentioned approach of loading report as a JSON Resource to display the modified report to the user.
Regards,
Akshay