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

How to dynamicly add a summary banner by testing each added Item

3 Answers 54 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jacobus
Top achievements
Rank 1
Jacobus asked on 16 Jul 2009, 12:40 PM
Hi,

I need to find out if there is some way for me to do checks in my report when it is generated. Currently I'm generating a report that receives a collection of objects as its datasource(via a bindingsource). Each of these objects in my collection is of type ITenderLineItem. This is an interface that I wrote. So basicly this list contains objects of different datatypes. They are: TenderSeries, TenderSection and TenderItem. All three these classes implements ITenderLineItem. Now in my report I'd like to display:

Series/Section Nr Item Nr Description Unit Qty Rate 1 Amount 1 Rate 2
                 
1000   General     0   0   --> Series  
1000   Section 1     0   0  
  10.1 Item 1     1000   1000  
  10.1 SubItem 1     2000   3000  



Summary Here
 
(i) SubSubItem 1 mm2 5 4000   7000  
2000   Housing     0   0  --> Series  
2100   Section 1     0   0  
  21.1 Item 1 UNIT 100 0   0  
  (i) SubItem 1     0   0  
  (i) Sub-SubItem 1     0   0  

Summary Here

But at the moment I'm just getting my report to display all Items:

Series/Section Nr Item Nr Description Unit Qty Rate 1 Amount 1 Rate 2
                 
1000   General     0   0  
1000   Section 1     0   0  
  10.1 Item 1     1000   1000  
  10.1 SubItem 1     2000   3000  
  (i) SubSubItem 1 mm2 5 4000   7000  
2000   Housing     0   0  
2100   Section 1     0   0  
  21.1 Item 1 UNIT 100 0   0  
  (i) SubItem 1     0   0  
  (i) Sub-SubItem 1     0   0  


The way I see it is that I'd need to have some sort of check in my report to determine if the Item being added is a Series Item and then to insert a summary section to summarize the totals per series etc. This I can do by castig the object or calling the ToString() method and checking what gets returned. Problem is I don't know how to do this sort of testing in my report. What events should I use and what expressions do I need to add to my TextBoxes.

Regards

Jacobus

3 Answers, 1 is accepted

Sort by
0
Hrisi
Telerik team
answered on 21 Jul 2009, 07:24 AM
Hi Jacobus,

You can change visibility of the report items dynamically, but adding new items during report processing is impossible. The Visible property of the items is included in the Style collection and thus can be changed trough Conditional formatting.

In your report for every data item (ITenderLineItem) one DetailSection is generated according to your report definition. If you extend the ITenderLineItem interface with one more property, for example ItemType and set it to one of your types: TenderSeries, TenderSection and TenderItem.

Because this
ItemType is repeated for items of the same type it can be used for grouping. If you add a group to the report with grouping criteria =Fields.ItemType you can see two sections GroupHeaderSection and GroupFooterSection. Set GroupHeaderSection.Style.Visible = False and GroupFooterSection.Style.Visible = False. In the GroupFooterSection place your summary info. Use Conditional formatting to set GroupFooterSection Visible style to True when Fields.ItemType == "TenderSeries".

Best wishes,
Hrisi
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jacobus
Top achievements
Rank 1
answered on 21 Jul 2009, 07:39 AM
Hi Hrisi,

Thanks for getting back to me. What if I now want to total those lines that have been printed before the summary banner. I specifically need to just have the total for each series Item and its children and then again for the next series item etc. And than at the bottom I'd like to have a grand total. The grand total I'll be able to do but I can't think of a way to formulate my expression to just give me the total of each series. This post worries me: http://www.telerik.com/community/forums/reporting/telerik-reporting/expressions.aspx

Is this a possibilty?

Thank you
Jacobus
0
Hrisi
Telerik team
answered on 24 Jul 2009, 01:57 PM
Hello Jacobus,

Are you trying to use the suggested approach from our previous post as it is not so difficult to achieve your requirements.

Your data looks like this:

Series/Section Nr

Item Nr

Description

Unit

Qty

Rate 1

Amount 1

Rate 2

1000

 

General

 

 

0

 

0

   --> Series

1000

 

Section 1

 

 

0

 

0

 

10.1

Item 1

 

 

1000

 

1000

 

10.1

SubItem 1

 

 

2000

 

3000

 

(i)

SubSubItem 1

mm2

5

4000

 

7000

2000

 

Housing

 

 

0

 

0

   --> Series

2100

 

Section 1

 

 

0

 

0

 

21.1

Item 1

UNIT

100

0

 

0

 

(i)

SubItem 1

 

 

0

 

0

 

(i)

Sub-SubItem 1

 

 

0

 

0



You should add one column for the series type to your data

Series/Section Nr

Item Nr

Description

Unit

Qty

Rate 1

Amount 1

Rate 2

SeriesType

1000

 

General

 

 

0

 

0

TenderSeries

1000

 

Section 1

 

 

0

 

0

TenderSeries

 

10.1

Item 1

 

 

1000

 

1000

TenderSeries

 

10.1

SubItem 1

 

 

2000

 

3000

TenderSeries

 

(i)

SubSubItem 1

mm2

5

4000

 

7000

TenderSeries

2000

 

Housing

 

 

0

 

0

TenderSection

2100

 

Section 1

 

 

0

 

0

TenderSection

 

21.1

Item 1

UNIT

100

0

 

0

TenderSection

 

(i)

SubItem 1

 

 

0

 

0

TenderSection

 

(i)

Sub-SubItem 1

 

 

0

 

0

TenderSection


Now, using this data as DataSource you can create a group with grouping criteria:
    =Fields.SeriesType

In the GroupHeaderSection or GroupFooterSection you can place TextBox with Value set to aggregate function, for example =Sum(Fields.Qty).

Sincerely yours,
Hrisi
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
Jacobus
Top achievements
Rank 1
Answers by
Hrisi
Telerik team
Jacobus
Top achievements
Rank 1
Share this question
or