Invoice with supporting pages?

Stimulsoft Reports.WPF discussion
TestBoy
Posts: 46
Joined: Tue Oct 23, 2018 8:14 pm

Invoice with supporting pages?

Post by TestBoy »

I am going to try my best to explain this...

For each record in a databand I need a page at the end. Let's say I have 50 invoice lines...

First n pages depending on whether or not they fit....

<databand>
record 1
record 2
record 3
record 4
record 5
.....
record 50
</databand>

New pages.....

<support for record 1>
<support for record 2>
....
<support for record 50>

And I need it to be conditional. I may not need the additional pages.
And the support pages are a subreport.

Basically, I need an invoice on the first n pages and if whoever is getting the invoice requires support I need to be able to add that support for each record to the end.

I tried adding two databands, one with the lines and various combinations of new page before/after and I end up with various weird looking results like the subreports spanning pages, the first one missing, the last one missing, the footer being printed in the header (not making that up) but nothing that even resembles what I need.
TestBoy
Posts: 46
Joined: Tue Oct 23, 2018 8:14 pm

Re: Invoice with supporting pages?

Post by TestBoy »

Okay, so I found out I can add a page and this does what I want.
The invoice portion gets data from a business object - and that works.

The second page has another databand that has the subreport in it.
That subreport was added from a file and that report requires two parameters.
When I add that I pick the subreport file and add the two parameters.
The name is the same as the name of the variables in the subreport and the expression points to the field in the business object.

The subreports don't display any data. I don't think it's even hitting the SQL server to get the data.
The variables are used in the SQL query that's in the subreport.

I don't know if I am doing this right either but I got a little further.

See attached.... what am I doing wrong?
Attachments
test.zip
(2.99 KiB) Downloaded 202 times
Lech Kulikowski
Posts: 6259
Joined: Tue Mar 20, 2018 5:34 am

Re: Invoice with supporting pages?

Post by Lech Kulikowski »

Hello,

To use Parameters in SubReports, you should use the expression:
{this["Var"]}

add a variable with the same name is not needed.

Thank you.
TestBoy
Posts: 46
Joined: Tue Oct 23, 2018 8:14 pm

Re: Invoice with supporting pages?

Post by TestBoy »

You have me at a loss.
The subreport needs the parameter.... so...?

Where does this line of code go then?
How does that populate the parameter in the subreport?
Is "Var" the name of the parameter in the suibreport?

I need a lot more context.
TestBoy
Posts: 46
Joined: Tue Oct 23, 2018 8:14 pm

Re: Invoice with supporting pages?

Post by TestBoy »

Ok, attached is an ENTIRE WORKSPACE that illustrates what I am trying to do.

Note that the subreport variables are indeed empty when you run it. I need those variables because in my real subreport they are passed to SQL.
These are very simplistic examples.
I need to know where and how those get passed in.... and remember, I don't know this like you chaps do so you have to tell me like, exactly where and how I get there.
Attachments
ReportFRomBusinessObject.zip
(3.1 MiB) Downloaded 204 times
Lech Kulikowski
Posts: 6259
Joined: Tue Mar 20, 2018 5:34 am

Re: Invoice with supporting pages?

Post by Lech Kulikowski »

Hello,

To use Parameters in SubReports, you should use the expression:
{this["ParameterName"]}

Thank you.
Attachments
Annotation 2019-01-03 150754.jpg
Annotation 2019-01-03 150754.jpg (274.55 KiB) Viewed 3645 times
TestBoy
Posts: 46
Joined: Tue Oct 23, 2018 8:14 pm

Re: Invoice with supporting pages?

Post by TestBoy »

But my subreport needs the variables to pass into it's SQL query?
Am I not able to do that?

My example didn't have the variables or the SQL query to keep it simple.
Lech Kulikowski
Posts: 6259
Joined: Tue Mar 20, 2018 5:34 am

Re: Invoice with supporting pages?

Post by Lech Kulikowski »

Hello,

You can use SubReport parameter in the query:
select * from Categories where CategoryID = {this["SubParam1"]}

Thank you.
Attachments
Annotation 2019-01-03 213243.jpg
Annotation 2019-01-03 213243.jpg (227.03 KiB) Viewed 3642 times
TestBoy
Posts: 46
Joined: Tue Oct 23, 2018 8:14 pm

Re: Invoice with supporting pages?

Post by TestBoy »

Ok, that worked.
Getting closer!

Here is my next issue. The subreport does run by itself as a regular report in other cases so I still need the variables.
The variables are assigned in the application.
I would like to keep using the variables because in the application I read the Name, Category,Alias, and Description values.
(these are GREAT! btw. Offtopic question: Can we extend these?)
I can work around this by using an IF in my where clause... like .... where GUID=IF( '{this["GUIDParam"]}' = '', @GUIDVar, '{this["GUIDParam"]}' )
Is there a better solution?

Otherwise, I think I am there.
Lech Kulikowski
Posts: 6259
Joined: Tue Mar 20, 2018 5:34 am

Re: Invoice with supporting pages?

Post by Lech Kulikowski »

Hello,

Yes, you can add variable in SubReport and use the following query:
select * from Categories
where CategoryID = {(this["SubParam1"] == null ? Variable1 : this["SubParam1"])}

Thank you.
Post Reply