Documentation for report scripting
I'm looking for more detailed information about scripting in the report module. A lot can be found here, but I'd also like to know for instance how to get the URL of the mapservice configured in the datasource, the access token, the current user, how to log debug information, etc.
-
Berend Veldkamp, can you provide some details about the use case you are trying to solve that needs access to the map service URL?
I don't believe it is possible to log debug information to the report log. The script runs in a specific security context that seems to disallow that. I was able to attach a Visual Studio debugger to the running instance as described here https://docs.devexpress.com/XtraReports/8543/detailed-guide-to-devexpress-reporting/reporting-api/use-report-scripts/debug-scripts-in-visual-studio. This is something that should only be done in a development environment though.
A cheeky workaround for logging is to put a Label control somewhere on you report and have your script write any log messages to the Text property of that control so they show up in the report output.
You can get at the data sources of the report like this. Also documented here https://docs.devexpress.com/XtraReports/403247/detailed-guide-to-devexpress-reporting/reporting-api/use-helper-classes#data-source-utility
I am not aware of any way to get the identity of the user. If this is possible it would not be via any supported API. I will take a look at whether we can expose the user name via expressions.
0 -
Hi Ryan,
One of our customers wishes to include filenames when adding attachments to a report. To do this, I'd need to copy the functionality of the multiple feature attachment control, and include a label. Someone posted an idea, but that was two years ago.
In the mean time I've found out how to get the datasource, but apparently that's a SqlDataSource, and not a feature service. If the attachment information is there, it's hard to figure out where exactly.
If I can get the ArcGIS token, retrieving the identity of the user would be trivial, it's a request to the /self REST endpoint.
So far I've used a label as a poor man's debugging tool, but it's cumbersome. And in any AfterPrint event it doesn't work at all.
Do you have some more information about how to use Visual Studio to debug? I have connected VS to the remote debugging tools, and included System.Diagnostics.Debugger.Break(); in my reporting script. I think that line gets hit, because VS is trying to load a temporary file (ogqc4ups.0.cs), which I think would be the script I wrote. It should be in C:\Windows\Temp, but I can't seem to find that file on the reporting server.
0
Comments
2 comments