Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Variable text symbol

Former Member
0 Likes
5,611

Hi,

How can i make a text symbol's text change during runtime?

All i can remember is that i need to set its value in GoTo > Text Elements > Text Symbols to '&'...

Thanks!

5 REPLIES 5
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,961

You can not change the value of a text element at design time nor at runtime. You must use a variable field. For example, take the following code. In this code, it passes a syntax check, but will give you a runtime error because you are trying to write to a protect field.



report zrich_0002.

field-symbols: <fs>.

write:/ text-001.

assign text-001 to <fs>.

replace '&' with 'Test' into <fs>.

Write:/ <fs>.

You must use a variable field. Take this code for example.



report zrich_0002.

data: a_text_field type string.
field-symbols: <fs>.


write:/ text-001.

a_text_field = text-001.

replace '&' with 'Test' into a_text_field.

write:/ a_text_field.


Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,961

Hi winnie,

1. whats ur exact requirement ?

regards,

amit m.

Read only

0 Likes
1,961

For example, i have a text symbol text-001.

given condition A, i need to display 'Condition A', else i need to display 'Other Condition'.

Is that possible?

Read only

0 Likes
1,961

You can not change the value of a text symbol.

Regards,

Rich Heilman

Read only

0 Likes
1,961

Hi winnie,

1. since text-symbol cannot be changed,

2. we can use simple variables

3. OR we can define 2 text elements.

001

002

and accordingly display

based upon the condition.

-- something like this.

if condition 1.

text-001.

else.

text-002.

endif.

4. It is always better to use text-elements

so that the program can be used

in other languages (in near future, if required)

regards,

amit m.

Message was edited by: Amit Mittal