Adding subreport to main report at runtime (RDLC)

Necuno

Court Jester
Joined
Sep 27, 2005
Messages
58,567
Adding subreport to main report at runtime (RDLC)

That is what i want to achieve at runtime; the original problem was to use ms reportviewer with an unkown total pages which are dynamic in the sense of layout hence being a first, middle and last. they do however all use the same data object collection differing only on first (client detail) and last (2 added tables where signatures and realted goes).

now as this post i want to be able to add to a main report subreports at runtime being RDLC's (if there is 3 for example) first middle and last, otherwise for more it would be first, middle, middle, ... and then finally last.

The RDLC files are allready setup however, my main is thing is which i can't seem to find is how from the main report file (dubbed "First") add a middle(s) or last as sub report at runtime.

i do see that however on each subreport render there is an event which you could do something, it is just how to add them to main.
 

Necuno

Court Jester
Joined
Sep 27, 2005
Messages
58,567
lol i think i want to cry a little in a dark corner.

it seems though that one have to had a sub report to the report in its design unles... justthinking i can do it via an xml update hmmm /goes back to code :)
 

FarligOpptreden

Executive Member
Joined
Mar 5, 2007
Messages
5,396
I'm so happy my report generating days are over....

Same here... My preferred method of generating reports is to serialize whatever object collection I have and transform it with XSLT and XSL:FO. That way you have a lot more control over what you want to achieve and you can reuse your business logic layer for reporting purposes as well...
 

Necuno

Court Jester
Joined
Sep 27, 2005
Messages
58,567
Same here... My preferred method of generating reports is to serialize whatever object collection I have and transform it with XSLT and XSL:FO. That way you have a lot more control over what you want to achieve and you can reuse your business logic layer for reporting purposes as well...

i remember that should have the link to the thread still somewhere ;)
 

FarligOpptreden

Executive Member
Joined
Mar 5, 2007
Messages
5,396

Did I write all that? :confused: :p

Anyway, what I'm referring to in this instance is a bit different though. You can use your objects, i.e. an Employee object, serialize the object to get the corresponding XML string / document and then transform that with XSL or XSL:FO.

XSL:FO is very powerful in the sense that you can output to proper document formats (like .pdf, .doc, .xls and .csv). You can even export the document to flow like a proper "book" with a cover pages and dynamically generated table of contents. It might seems daunting initially, but the results will be very satisfying... ;)

XSL, as you know, is the easier alternative to just transforming your object's serialized XML to HTML or any other markup language. Still useful if you have an interpreter for the specific markup language. Come to think of it, you could just use XSL to transform your object to a nice .rdl file and upload that to the report server! :p
 

Necuno

Court Jester
Joined
Sep 27, 2005
Messages
58,567
i opted for this:

one report with 1 sub report in a rectangle with page breake just before it which is then read into an xmldocument at run time, then i modify the xml to clone and insert the initial rectangle with the sub report in it and setting each one's values accordingly for the needed amount of pages and which rdlc's it must use.

evently some of the localreport via reportviewer are also changed with an event that set's the data source for the subs.
 
Top