Dynamic creation of elements with conditions

Stimulsoft Reports.NET discussion
Post Reply
SergioT
Posts: 7
Joined: Tue Jan 31, 2017 1:22 pm

Dynamic creation of elements with conditions

Post by SergioT »

Hi All,

I want to achieve the following:

In a Databand, and upon a variable named Quantity, I want to display as many empty textbox as the variable says in a 10x10 structure like in the picture below.
structure.png
structure.png (2.77 KiB) Viewed 1588 times
The obvious way i came up with was to create a full 10x10 estructure and set each element with a different condition (first element will hide if Qty<1, second element will hide if Qty<2...and so on until the last element that will hide if Qty<100). Of course, in this case is more or less manageable, but imagine I had 1000 or 5000 textbox.

So my question is if there is any way to create a dynamic structure. I haven't found a way to do this in the graphic editor, and neither I have found a way to do this in the Code tab because each element condition is associated with a private method so I would need to write the 100 method conditions.

Any insight on this idea?

Thanks in advance.

Best regards.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Dynamic creation of elements with conditions

Post by Alex K. »

Hello,

You can try to create a necessary report from code in your project.
Please check the sample in the attachment.

Thank you.
Attachments
CreateReportInCode.zip
(11.73 KiB) Downloaded 125 times
SergioT
Posts: 7
Joined: Tue Jan 31, 2017 1:22 pm

Re: Dynamic creation of elements with conditions

Post by SergioT »

Hi Aleksey,

Thank you so much for the prompt response and the example you attached.

Unfortunately, we are not allowed to code our reports and we are only allowed to use the graphic editor and its code window.

This time i took the shortcut and I've made the 10x10 structure, hope in the future I am not faced with a much bigger structure...

Thanks again.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Dynamic creation of elements with conditions

Post by Alex K. »

Hello,

Ok.
Please let us know if you need any additional help.

Thank you.
Post Reply