Repeated databand according to a value

Stimulsoft Reports.NET discussion
Post Reply
Jennypi
Posts: 361
Joined: Mon Nov 17, 2008 7:13 am
Location: France

Repeated databand according to a value

Post by Jennypi »

Hi,

My report displays a list, let's say of orders.
I would like to display 3 rows (instead of 1) for an order if the field client = "AAAA".
How can I do that ?

Many thanks.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Repeated databand according to a value

Post by Alex K. »

Hello,

You can add the variable and After Print event of DataBand use the following code:

Code: Select all

if (VariableCountRepeat < 2 && DataSource.Field == "AAAA")
{
	DataSource.Prior();
	VariableCountRepeat ++;
}
Please see the sample report in attachment.

Thank you.
Attachments
720.SampleReport.mrt
(16.8 KiB) Downloaded 391 times
Jennypi
Posts: 361
Joined: Mon Nov 17, 2008 7:13 am
Location: France

Repeated databand according to a value

Post by Jennypi »

Thanks for your reply.

I tried something like this (either in before or after print event):

Code: Select all

if (DataSource.Field=="AAAA")
{DataBand1.CountData=3]
But it's not working, concerned rows are only listed once.
Am I missing something?

Thank you.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Repeated databand according to a value

Post by Alex K. »

Hello,

Your way is not correct, since the CountData property is used if there is no binding of the data band to a data source.

Thank you.
Jennypi
Posts: 361
Joined: Mon Nov 17, 2008 7:13 am
Location: France

Repeated databand according to a value

Post by Jennypi »

Ok I understand.
So I created another databand (DataBand2) linked to my datasource.
DataBand1 has now Databand2 as a master component.

I put my code in the Before or AfterPrint event of the master DataBand, but again, it is not working.


Thank you for your help!
Jennypi
Posts: 361
Joined: Mon Nov 17, 2008 7:13 am
Location: France

Repeated databand according to a value

Post by Jennypi »

I forgot to set the Count Data property of DataBand1 to 1.
It seems to be working ok now.

Thank you very much.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Repeated databand according to a value

Post by Alex K. »

Hello,

Please look an example, I sent you in my first post, once again. Everything works as you need.

Thank you.
Post Reply