Email report in CSV instead of PDF format  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Email report in CSV instead of PDF format

Postby Ernst » Mon Jul 30, 2018 9:29 am

Am scheduling a report via a plugin, but the customer wants the file in CSV format, instead of PDF format.

Has anybody managed to get this to work. Thx.

Im using 7.0.175 and mostly vb .net.
User avatar
Ernst
Kohai
Kohai
 
Posts: 219
Joined: Tue Feb 19, 2008 3:43 pm
Topics Solved: 12

Re: Email report in CSV instead of PDF format  Topic is solved

Postby Mike.Sheen » Mon Jul 30, 2018 10:20 am

Ernst wrote:Am scheduling a report via a plugin, but the customer wants the file in CSV format, instead of PDF format.

Has anybody managed to get this to work. Thx.

Im using 7.0.175 and mostly vb .net.


Hi Ernst,

If you take a look at this topic, you should be able to just change the the line which reads:
Code: Select all
printReportObject.CrystalReportObject.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, FileName);

To:
Code: Select all
printReportObject.CrystalReportObject.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.CharacterSeparatedValues, FileName);



If the report is a stored procedure based report, then I think it would be vastly more efficient to simply call the stored procedure and write away the results to a csv.

Mike
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Email report in CSV instead of PDF format

Postby SBarnes » Tue Jul 31, 2018 10:18 pm

Hi Ernst

You can actually get ServiceStack to do the heavy lifting to produce the CSV see http://docs.servicestack.net/csv-format if the report is a stored procedure as Mike suggested.

Its T4 Templates can also create the stored procedure code for you, see https://books.google.com.au/books?id=x9hpBgAAQBAJ&pg=PA129&lpg=PA129&dq=servicestack+t4+templates&source=bl&ots=dJ3MSKNy6A&sig=-txxhkU4d-du5ZO85Zynf5GjeRU&hl=en&sa=X&ved=2ahUKEwiB042Rm8ncAhXBdN4KHQsFBLEQ6AEwBnoECAQQAQ#v=onepage&q=servicestack%20t4%20templates&f=false on how to do this.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Email report in CSV instead of PDF format

Postby Mike.Sheen » Sat Aug 04, 2018 6:12 pm

SBarnes wrote:You can actually get ServiceStack to do the heavy lifting to produce the CSV


Indeed! You can also get ServiceStack to do the same for reading a CSV - as Jiwa now ships (since 7.1) with the ServiceStack libraries, any plugin can leverage that to read a CSV into a List<T> as shown in the plugin "Bendigo Bank Cashbook CSV Imports" included as part of 7.2:

Code: Select all
List<BendigoBankSimpleCSVTransaction> transactions = ServiceStack.Text.CsvSerializer.DeserializeFromString<List<BendigoBankSimpleCSVTransaction>>(sb.ToString());
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 16 guests

cron