You are not logged in.
Pages: 1
Hi,
I´m trying to create an output generator in RS 4.6.
In the documentation I see an example about creating a TableOutputGenerator from scratch.
However, I don´t want to create it from scratch. I want to extend output generator for CSV files, just changing the extension of the output file.
Is there any example that you could provide or any class I should use as reference ?
Thanks.
Offline
There is a CSVOutputGenerator class: https://reportserver.net/api/latest/jav … rator.html
this should create you a csv out of your table ... and you can stream it into any file you want.
Or do you need an example how to execute a report? I'll suggest https://github.com/infofabrik/reportser … ail.groovy
just strip off the "send email" part
you can play around with the OUTPUT_FORMAT_XYZ part to get different results (just like the "export to" button in the report view)
further reading: https://reportserver.net/api/latest/jav … rvice.html
kind regards
Felix
Softwareentwickler bei Infofabrik
Offline
Do you have an sample like this you provided , but for sending to local file instead of email ?
Offline
Hi marcioribeiro1979,
you can define a local filesystem datasink and then send your report like this:
https://github.com/infofabrik/reportser … ink.groovy
Regards,
Eduardo
Offline
Thanks Eduardo.
One final question: how to send the email to multiple destinations ? I´ve tried comma (,) , I´ve tried semicolon (;) but they didn´t´work.
Offline
Hi marcioribeiro1979,
you can see here: https://reportserver.net/api/latest/jav … ang.String...-
that this is a list. So you should be able to do this like this:
mail.toRecipients = ['my@email.com', 'my2@email.com']
You can also use the overloaded method:
mail.toRecipients = 'my@email.com', 'my2@email.com'
Pls always refer to the javadocs for scripting:
The javadocs can be found here: https://reportserver.net/api/latest/javadoc/index.html
List of entities: https://reportserver.net/api/latest/entities.html
List of hooks: https://reportserver.net/api/latest/hooks.html
List of services: https://reportserver.net/api/latest/services.html
Also, pls refer to the scripting guide:
https://reportserver.net/en/guides/script/main/
Regards,
Eduardo
Offline
Hi Eduardo,
I´m capturing the email in a form, same as the example provided:
"form" : {
"labelAlign": "top",
"fields": [{
"id": "email",
"type": "string",
"label": "Email Address",
"value": "name@example.com"
}]
}
Then, the value of input goes to script as a string:
mail.toRecipients = values['email']
So, I´m assuming in this example I cannot use multiple destinations, unless I convert the form to accept multiple entries, is that correct ?
Offline
Hi marcioribeiro1979,
you can also accept ","-separated emails in the form, parse this string and convert it to a list:
mail.toRecipients = convertToList(values['email'])
Regards,
Eduardo
Offline
Pages: 1