Forum Discussion
basic question about variable assign
Hi folk,
very new to APM, have a lot questions on assign variable
why sometimes it's
variables { { expression "mcget {session.logon.last.username}" varname session.sso.token.last.username } { expression "mcget {session.logon.last.password}" varname session.sso.token.last.password } }
but sometimes it has another "expr" in front, what's the difference?
variables { { expression "expr {[mcget {session.logon.last.password}]}" varname session.logon.last.password2 } }
4 Replies
- Josiah_39459Historic F5 Account
expr just tells it to evaluate the string, so "1+1" without expr would be "1+1" and with expr would be 2. People tend to use it a lot when it's not necessarily needed. Personally, I prefer using "return" and returning explicitly what I want.
- Saravanan_M_K
Employee
variables { { expression "expr {[mcget {session.logon.last.password}]}" varname session.logon.last.password2 } }In your example, the expr is actually not needed. The above will produce the same result as in the config:
variables { { expression "mcget {session.logon.last.password}" varname session.logon.last.password2 } }However, you can evaluate any tcl expression using "expr". For example:
variables { { expression "expr {[string tolower [mcget {session.logon.last.username}]]}" varname session.custom.user } } - Yaoxie_117356
Nimbostratus
Thanks you both for taking time answering my questions.
- Yaoxie_117356
Nimbostratus
Thanks you both for taking time answering my questions.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com