Forum Discussion
Andrea_Arquint
Nimbostratus
Aug 13, 2013How to combine two variables together in APM variable assign
Hi
I would like do combine two variables together:
Right now I have something like this:
session.logon.last.username = expr { [mcget {session.ntlm.last.username}] }
And I want to have ...
Lucas_Thompson_
Aug 13, 2013Historic F5 Account
Hi, thanks for the question.
In Variable Assign (or branch rules), you can include any TCL you want. The TCL command "expr" is used because the results are mostly boolean. For a variable assignment though, they are mostly strings, so the expr command in this context is inappropriate. Better to use "return". This avoids problems where expr's number conversion can mess up text strings. So, to concatenate them, it would be simply:
session.logon.last.username = return "[mcget {session.ntlm.last.username}]\\[mcget {session.ntlm.last.domain}]"
If you want, you can also put some logic in the right-hand of the assignment, like if sometimes the user already put in USERNAME\DOMAIN:
session.logon.last.username =
if { [mcget "session.logon.last.username"] contains "\\" } {
return [mcget "session.logon.last.username"]
else {
return "[mcget {session.ntlm.last.username}]\\[mcget {session.ntlm.last.domain}]"
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
