Page 1 of 2

Data binding in the report

Posted: Wed Apr 18, 2018 8:49 am
by EdQ
Hello,
In the report I have a Text field which is bound to the Variable Var1. When I run the report the default value of Var1 is shown in the Text field as expected. When I change the value of Var1 in a Click event Var1=”12345” the value of Text filed is not changed to “12345”. It still shows the default value. How can I solve this problem? Thank you.

Re: Data binding in the report

Posted: Thu Apr 19, 2018 4:53 am
by Edward
Hi Ed,

Sorry, could not reproduce the problem. Have you tried to set the variable's value as per the following sample project?

https://www.stimulsoft.com/en/samples/w ... es-in-code

Thank you,
Edward

Re: Data binding in the report

Posted: Thu Apr 19, 2018 6:48 am
by EdQ
Hi Edward,
Not that way like in the link. I am using only the Designer for WPF as following.
1. New empty report
2. Create a new variable and give it the name Temp and assign it a default value.
3. I drag a Text component on the Report and bind it to the Temp variable
4. Preview the report and the Text component shows the default value of the variable Temp
5. I create a Click event for the page and write the following code in the event editor
Temp = ”Hello World”;

I expect thatthe text “Hello World” to be shown in the Text component but it still shows the default value.

Thank You

Re: Data binding in the report

Posted: Thu Apr 19, 2018 8:14 am
by Lech Kulikowski
Hello

In this case, you should rerender report with new values:

Variable1 = "321";
this.Render(false);

Thank you.

Re: Data binding in the report

Posted: Thu Apr 19, 2018 8:51 am
by EdQ
It works.

Thank You very much!

Re: Data binding in the report

Posted: Fri Apr 20, 2018 1:42 am
by Edward
Hi Ed,

Thank you very much for explaining your task in greater detail and to confirm the Lech's advice has solved the problem.

Please let us know if you need any help.

Thank you,
Edward

Re: Data binding in the report

Posted: Mon Apr 23, 2018 12:56 pm
by EdQ
Hi Esward,
I have another question. First what I am doing.
1. Create new report in Designer
2. Create a new Data source called Person. Person is a class in my Visual studio project.
public class Person
{
public string Name { get; set; }
public string Surname { get; set; }
}
3. In the Visual studio project I create a List<Prerson> like _person = new List<Person>(); and register the data to the report
report = new StiReport();
report.RegData("Person", _persons);
report.Load("Report.mrt");

4. In the designer I drag the Data source on the page and a table is created automatically.
5. The click on preview shows the report. The table shows the data, 20 rows, as expected.

Now in my visual studio project I change the Name and Surname of a person like _person[4].Name=”name1”;
_person[4].Surname=”surname1”;
I expect to see these changes in the report, but the report shows always the old values. I tried the report.Render() but no success. What can I do in this case?

Re: Data binding in the report

Posted: Tue Apr 24, 2018 2:45 am
by Edward
Hi Ed,

Thank you for explanation of the problem in detail.

Please check the following topics:
viewtopic.php?f=8&t=846

And more information on Business Objects registration please check in the following documentation page:
https://www.stimulsoft.com/en/documenta ... ionary.htm

If you clear the Dictionary and re-register your data, the report data will refresh itself.

Also there is a way to replace the already registered data as it was suggested in the following topic:

viewtopic.php?f=13&t=37064

Thank you,
Edward

Re: Data binding in the report

Posted: Tue Apr 24, 2018 12:01 pm
by EdQ
Hi Edward,

it worked,

Thank You very much.

Re: Data binding in the report

Posted: Tue Apr 24, 2018 2:01 pm
by EdQ
Hi Edward,

another point. To avoid rendering delay for a huge amount of data, the report shows the data part by part. It works very well.
Now, when the user save the report as PDF or other format, the generated PDF shows the rows of data that the report has in that moment.
What I like to do is this. When the user click on save as, I clear first the actual data of the report and register the all huge data in the report. In this way I hope that the PDF shows all the data.
How can I do that?

Thank you in advance