Antoine_Sauteron_1266

How to read a variable with ampersand

Discussion created by Antoine_Sauteron_1266 on Nov 11, 2016
I have a UC4 job which reads a value from the read buffer and then sets a job plan variable using PSET.
The value that is read contains an ampersand character i.e.   6+@}/r&M

The PSET appears to work, however, the POST-CONDITIONS of the job fail – complaining that 'U1001308 Variable 'M' has not yet been defined.'.

So, how can I pass a value containing an ampersand to a job without it failing in this way?

The main problem is that the AE server will try to resolve strings as variables if they contain the "&" character.
However this can probably be bypassed with the scenario below : store the value in a separate (STATIC) VARA object with :PUT_VAR, then retrieve it with GET_VAR.


SCRI.AMPERSAND

:READ &AMPERSAND# ,,"Type in a string that contains &"
:PUT_VAR VARA.AMPERSAND,"value",&AMPERSAND#
:SET &RESULT# = GET_VAR(VARA.AMPERSAND,"value")
:P Your string is &RESULT#
Then start :

orsmg6pls10l.png

VARA.AMPERSAND is populated :

53c2l6r58s8f.png

And the report contains the expected value :
kcndtcvrqmbj.png

Best regards,
Antoine


Outcomes