yes, in order to use the internal reportserver file system you have to work with the services to read the file contents.
Thanks for posting your solution.
Regards,
Eduardo
According to the documentation (https://reportserver.net/en/guides/scri … -to-Files/), use:
def query = GLOBALS.services['fileService'].read('/fileserver/bin/queries/data1.sql')
I am trying to read my SQL query from .sql using Groovy's File library. I have the following line of code:
def query1 = new File('/fileserver/bin/queries/data1.sql').text
where my SQL file data1.sql is under the ReportServer path '/fileserver/bin/queries'. However, I am getting the following error when I try to execute my Groovy script:
The report could not be executed: net.datenwerke.rs.scripting.service.scripting.exceptions.ScriptEngineException: javax.script.ScriptException: java.io.FileNotFoundException: /fileserver/bin/queries/data1.sql (No such file or directory)
------- SCRIPT ERROR INFO -------
Script execution failed.
error message: javax.script.ScriptException: java.io.FileNotFoundException: /fileserver/bin/queries/data1.sql (No such file or directory) (java.io.FileNotFoundException)
script arguments:
file: ...
line: def query1 = new File('/fileserver/bin/queries/data1.sql').text
May I ask how I could fix this? Thank you!
]]>your groovy script should be able to parse the .sql file and look for the relevant query. You would have to write a parser/lookup for that, but it should be doable.
Regards,
Eduardo
Am wondering if it is possible to factor out my SQL queries from my groovy script reports into a .sql file, and then import the relevant queries into the script reports. How should I go about doing this?
]]>