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

Can't get running item count working...

3 Answers 272 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Etienne
Top achievements
Rank 1
Etienne asked on 15 Jul 2013, 07:39 PM
I have this report, that use hierarchical instances of business objects (eg. Master details) as DataSource.
I display the entire tree using a system of report and sub-reports. Data is passed from the parent report to the child report by setting a Binding (using Report.Bindings property) on the "DataSource" property of the child report.

Now, I need to display the last leaf item "running count" or "row number" , in relation to the topmost report. I've tried to use the "RowNumber", "RunningValue", "Exec" functions to resolve my problem, but it keep giving me this "Invalid Scope" error for all functions. 

So in the details of my "leaf" report (3rd level of sub-report), I've tried use theses expressions  to display the "running count" of leaf items. No success. They all end up with an "InvalidScope" error.

1) =Exec("MasterReport",Count(1))
2) =RunningValue("MasterDetailSection", Count(Fields.Name))
3) =RowNumber("MasterReportName")
4) =RowNumber("MasterDetailSection")

Where:
- "MasterReport" is the value of the Report.Name property of my master report
- "MasterReportName" is the Name property of the DetailSection of the master report.

Can anyone help me with this ?

3 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 19 Jul 2013, 11:42 AM
Hi Etienne,

It is not clear what is the scenario from your description. Basically, specifying the report as scope requires the expression to be on the master report's level. Using your first expression in a master report's group sections should work and give you the number of rows.

For more details, take a look at the Expression scope and Data Functions help articles.

If you need further help, please elaborate on the scenario and the needed calculations. Feel free to open a support ticket and send us there your report definition as addition to the requested details.

Regards,
Stef
Telerik

Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.

0
Etienne
Top achievements
Rank 1
answered on 19 Jul 2013, 03:12 PM
No, the expression is NOT in the master report, but in a sub-report.
To explain more clearly, let just consider 2 level of embedded reports. A top level "MasterReport" and a sub-report named "ChildReport".
The "ChildReport" is in the details section of the "MasterReport".
I just want a running count of the details of the "ChildReport".

Ex. This is the full report result:

Master Item - Sellers
   1.Child item - John
   2.Child item - Adam 
   3.Child item - Jack
Master Item - Managers
  4.Child item - Jill
  5.Child item - Roger
  6 Child item - Richard.

Here "Seller" and "Manager" are rendered in the master report
and the names (eg. John, Jack, Jill, etc...) and the positions are rendered in the child report.

I needed to found a way to have this "1,2,3,4,5,6" numbers to be generated by the reporting system.

I found a workaround by observing that for the lifetime of the report generation, the "ChildReport" class is instantiated once. 
Then I bound a event callback to the ItemDataBinding on the textbox displaying the position.
In the callback, I increment my count that is stored in a class member, and set the Value property of the textbox with it.



 
0
Stef
Telerik team
answered on 25 Jul 2013, 11:14 AM
Hi Etienne,

The easiest way is to prepare your data in such way that you have the row count in it. On report level getting that row number can be achieved using your current approach - counting how many times a TextBox item in the sub report Detail section is bound to data.

Let us know if we can be of any further help for you.

Regards,
Stef
Telerik

Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.

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