1. Jay Madren
  2. Valentina Reports ADK
  3. Samstag, Januar 25 2020, 12:25 AM
  4.  Abonnieren via E-Mail
I am trying to create a multipage PDF from two reports in Xojo. I am using a BinaryStream with VReport.PrintToBuffer(). The problem is that the second report overwrites the first one. For example, if I do something like this:

bs = BinaryStream.Create( f, True )
bs.Write( Rep1.PrintToBuffer( EVReportPrintType.kToPDF ) )
bs.Write( Rep2.PrintToBuffer( EVReportPrintType.kToPDF ) )
bs.Close

then the resulting PDF contains only the second report.

Why is this? How can I get both reports into one PDF file?

Also, on another note, the wiki entry for VReport.PrintToBuffer() says this:
Prints all pages or the specified range of pages of the report to the disk file at the given location.

which of course is not correct.
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
Hello Jay,

Did you try multipart reports added in version 9.5?

PDF is a complex format and can't be managed without some PDF utility or library, like Ghostscript (it was discussed on the Xojo forum https://forum.xojo.com/23749-merge-pdfs/0)
Referenzen
  1. https://valentina-db.net/docs/dokuwiki/v9/doku.php?id=valentina:products:vstudio:help:report_editor:multipart_reports
Kommentar
There are no comments made yet.
Jay Madren Akzeptierte Antwort
Yes, I found pdftk and it works. I will look into multipart reports. Thanks.
Kommentar
There are no comments made yet.
Jay Madren Akzeptierte Antwort
Did you try multipart reports added in version 9.5?

Ok, so I looked at multipart reports, but I don't know how to supply the sql query for one part from Xojo. I build the query in Xojo because it is dynamic so I can't use a static report query. I then supply the query sql to the report when calling VProject.MakeNewReport(). But with multipart reports, how to I specify which part this sql is for?
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
Hello Jay,

You can use $P!( param_name ) parameter in the query and VReport.SetParameterValue( "param_name", "WHERE field_id > 5" ) in Xojo code.

For example, the following query is set for the second part:
SELECT * FROM customer $P!(customer_filter)

Default filter on the Parameters tab:
WHERE customer_id < 10

Without the default, this query returns all records.

Actually, this parameter can be used instead of the query, so the whole query can be specified in SetParameterValue method.
Anhänge
Kommentar
There are no comments made yet.
Jay Madren Akzeptierte Antwort
Ah, so adding an exclamation point (!) to the parameter placeholder prevents the substituted text from being quoted. Always wondered what the difference was between "Insert Parameter..." and "Insert Placeholder...". You should add this to the documentation.

Also, I assume we will need to keep the parameter names unique across all queries used in a multipart report. I already use parameters for the first report.

But, all of this is getting about as complicated as using subreports, at least in my case. The dynamic query for this report is very complex, and to test the report in VStudio I need to build/modify the query a lot. Having to keep assigning or modifying the query in a parameter during development adds extra steps and complexity. Seems like a better solution would be the ability to set the query for each report like we currently can for non-multipart reports.

Since I have pdftk working satisfactorily, I will stick with that for now. Thanks.
Kommentar
There are no comments made yet.
  • Seite :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 2 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories