Page 1 of 1

Get value of text component

Posted: Fri Jul 03, 2020 12:35 pm
by ureka
Hi,

I have assigned text component with value from datasource. When i try to get the value in before print event using Text1.text, i'm getting {DataSource1.param2} instead of the actual value. How to get the assigned value?

Re: Get value of text component

Posted: Mon Jul 06, 2020 5:33 pm
by Lech Kulikowski
Hello,

In the PHP version, code events are not supported.

Thank you.

Re: Get value of text component

Posted: Tue Jul 07, 2020 7:21 am
by ureka
Hi,
Thanks for your response.
I'm changing the height of the text component using Text1.height, but this has to be done only based on the value from datasource.
I thought i can get the value from text component and use the same to check whether the condition is satisfied or not but as per your response that is not possible, so is there any other way to achieve the same?

Re: Get value of text component

Posted: Tue Jul 07, 2020 9:22 am
by Lech Kulikowski
Hello,

Unfortunately, no.

Thank you.

Re: Get value of text component

Posted: Sun Jan 31, 2021 2:58 pm
by cbrydon
I realize this is a bit of an older post, but could you not use the following expression to get the actual value of the text component?

{Text1.Text.Value} == "some string"

Text1.Text.Value I believe is always stored as a string so if you need to compare the value to an integer, the following expression should work.

int.Parse(Text1.Text.Value) == 2

Re: Get value of text component

Posted: Mon Feb 01, 2021 1:38 pm
by Lech Kulikowski
Hello,

During the report, rendering exists two instances of each component (minimum two instances). One instance - component in the report template. Second instance - component which created the rendered report. During the creation of the second instance, report engine calculates expressions and write it to the second instance. When you write code like this:
Text23.Text = "test";
you call instances from report template which does not contain calculated values from expressions.

You can:
1. Instead of "{Text1.TextValue}" expression using the same expression as in Text1.Text property, or
2. Use variables. In this case, you can calculate value in variable, and then use this variable in expressions.

Thank you.

Re: Get value of text component

Posted: Mon Feb 01, 2021 2:11 pm
by cbrydon
Thanks for the explanation Lech!

Re: Get value of text component

Posted: Mon Feb 01, 2021 8:55 pm
by Lech Kulikowski
Hello,

You are welcome.