Change Text Value by code

Stimulsoft Reports.JS discussion
Post Reply
ricardolb
Posts: 2
Joined: Tue Jun 06, 2017 7:02 pm

Change Text Value by code

Post by ricardolb »

Hello there, I'm testing Stimulsoft reports for javaScript, I would like to know if I can
change the value of a Text component inside a Report by code, how can I do that?

Thanks in advance..
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: Change Text Value by code

Post by Edward »

Hi Ricardo,

If you define a variable var1 in the Report Dictionary and if you add this variable into the Text Component as follows:

Code: Select all

{var1}
then you could change the value of this variable from the code as follows:

Code: Select all

report.dictionary.variables.getByName("var1").valueObject = "your value";
Thank you,
Edward
ricardolb
Posts: 2
Joined: Tue Jun 06, 2017 7:02 pm

Re: Change Text Value by code

Post by ricardolb »

Hi Edward, thanks for your reply, I used a different approach, creating a Text component in Runtime.

It worked!

Thanks,
Ricardo
Andrew
Posts: 4107
Joined: Fri Jun 09, 2006 3:58 am

Re: Change Text Value by code

Post by Andrew »

Hello,

Great! Thank you for letting us know about this.

Have a nice day!
Post Reply