This is a migrated thread and some comments may be shown as answers.

PageBreak only if subreport has data

1 Answer 75 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
K
Top achievements
Rank 1
K asked on 14 May 2014, 11:10 PM
I'm building a report that uses a subreport in the report header.  This subreport will only occasionally contain data, so I have used this link to help me hide the subreport when it has no data, and this works fine.  However, I also want to force the subreport to be on its own page when it is visible, but I can't figure out the appropriate binding to make this happen. 

For the reportHeader section (that contains the subreport), I already have the following binding:

Property Path: Height
Expression:  = "1px"

I want to add

Property Path: PageBreak
Expression:  = IIF(???, PageBreak.After, PageBreak.None)

I tried  setting ??? to ReportItem.Height > "1px", but that caused error "Cannot perform '>' on Telerik.Reporting.Drawing.Unit and System.String.
I tried setting ??? to ReportItem.subreport2.Visible  that caused error object subreport2 not defined in the current context.

What is the correct binding code to detect if the subreport was visible or not?

Alternatively, in code I have tried

var rptBook = new ReportBook();
var rpt1 =
new MyReport1();
if (rpt1.Report.Visible) rptBook.Reports.Add(rpt1);
var rpt2 =
new MyReport2();
rptBook.Reports.Add(rpt2);

but this doesn't work, because the report hasn't executed when I test the Visible property.  Can I do something differently to make it work this way?

Thanks







1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 19 May 2014, 03:27 PM
Hello Kellie,

Our suggestion is to use a User Function in the "???" placeholder in the Iif function. Then you will be able to set the condition in code. When setting the condition you may find useful the Reporting API Reference.

In case you need further help, please provide us with a runnable sample project/report definition in which you are trying to set the page break. If there is any sensitive information in the project, you can open a support ticket and attach the files there. After we are familiar with the specifics of your project we can give you further suggestions on how to proceed.

Regards,
Nasko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
K
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or