Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
executing script-code on early event to abort report and reuse of code
shazia
Hi,
i want to achieve this:
- create report template with scriptcode that fires on a event. F.ex. on Master Page->onPageStart() . As all reports i create will be from this template (achieve re-use)
- in the scriptcode retrieve a accesscode as request-parameter/context <-- this i have achieved.
- in the scriptcode do a sql-query (f.ex.: select hasAccess from usertable where usertable.username=<username-parameter>) (my sql will be better, its just an example)
then have the scriptcode:
if(hasAccess==true)
//do nothing, carry on processing report
else
//abort running report (as the user does not have access)
my question are:
- how can i abort/cancel an report programmatically in a script-event?
- in which script-event should i do the sql-query ? (it should be earliest possible).
- what is the best way to achieve the reuse of this code. Create an template or is it for example possible to create a super-report that all my reports can easily extend ?
the cons of using a template is, if i decide to change the template-code, then i have to change this in every report i have earlier made with this template. Using a super-report or similar approach will just have all the code in one place ? What do you think?
Find more posts tagged with
Comments
mwilliams
One thing you can do is to drop all of the elements, in the beforeFactory, if your check comes back to drop. You can then use this value in the report to redirect the report to another page or do display a label that says the user doesn't have access. As for re-usability, you could do all your checks in an external file that you call from your beforeFactory, before you decide to drop all the elements.
I guess you could always just do this check before calling the report in the first place. This would take a step out of the process.