Function string() unexpected char and field not available errors
book
Article ID: KB0074802
calendar_today
Updated On:
Description
When using the string() function, all values we try return errors:
- unexpected char
- unexpected token
- the field is not available from any stream
What is the correct syntax?
Resolution
The string() function is used to convert any simple StreamBase Expression Language type (int, bool, blob, ...) into a string type.
It's usages are:
A. For defining a string literal, the correct syntax is:
"some text"
string("some text") -- a redundant conversion from a string to a string
B. For converting another field:
string( fieldName )
What is not allowed is using unquoted text as so:
string(s3a://dev-pi/DEV/rutger/MNO/vlf/PIDATA_) -- illegal
string(HDP_cluster_18) -- illegal if this does not refer to a field or Dynamic Variable
Unquoted text is interpreted by the compiler as the name of a field or Dynamic Variable. If the identifier naming conventions are not matched (an initial alphabetic character followed by optional alphanumerics and underscores) then the "unexpected char" error is reported. If the text matches the identifier naming conventions but no field by that name is available in that context the "field is not available" error is reported.
If referencing a Module Parameter as so:
string( ${PARAM1} )
then the literal value of the parameter must include surrounding quotes. If the parameter value is to be interpreted as literal text but will not include quotes, then this expression syntax is allowed:
string( "${PARAM1}" )
The parameter substitution occurs first and ignores the presence of quotes before the expression is evaluated.
Issue/Introduction
StreamBase Expression Language guidance
Feedback
thumb_up
Yes
thumb_down
No