Get value of text component

Stimulsoft Reports.PHP discussion
Post Reply
ureka
Posts: 3
Joined: Mon Jun 15, 2020 12:21 pm

Get value of text component

Post 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?
Lech Kulikowski
Posts: 6163
Joined: Tue Mar 20, 2018 5:34 am

Re: Get value of text component

Post by Lech Kulikowski »

Hello,

In the PHP version, code events are not supported.

Thank you.
ureka
Posts: 3
Joined: Mon Jun 15, 2020 12:21 pm

Re: Get value of text component

Post 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?
Lech Kulikowski
Posts: 6163
Joined: Tue Mar 20, 2018 5:34 am

Re: Get value of text component

Post by Lech Kulikowski »

Hello,

Unfortunately, no.

Thank you.
cbrydon
Posts: 173
Joined: Fri May 30, 2014 4:37 pm

Re: Get value of text component

Post 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
Lech Kulikowski
Posts: 6163
Joined: Tue Mar 20, 2018 5:34 am

Re: Get value of text component

Post 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.
cbrydon
Posts: 173
Joined: Fri May 30, 2014 4:37 pm

Re: Get value of text component

Post by cbrydon »

Thanks for the explanation Lech!
Lech Kulikowski
Posts: 6163
Joined: Tue Mar 20, 2018 5:34 am

Re: Get value of text component

Post by Lech Kulikowski »

Hello,

You are welcome.
Post Reply