Get the actual value of the text component

Stimulsoft Reports.PHP discussion
Post Reply
felixandrea
Posts: 1
Joined: Tue Jul 30, 2024 8:54 am

Get the actual value of the text component

Post by felixandrea »

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.

Can I 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: 6651
Joined: Tue Mar 20, 2018 5:34 am

Re: Get the actual value of the 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.
Post Reply