Forum Discussion
How to stop an APM variable converting string to number
Hello Alex.
This is working for me:
session.logon.last.username = expr { "[mcget {session.logon.last.username}].0" }
Regards,
Dario.
- AlexBCTAug 27, 2021Cumulonimbus
Hi Dario,
Thanks for the response!
I've just tried this one in my lab, but unfortunately it still strips off the leading 0 when I look at session.logon.last.username afterwards. When you run it with for example 012346 as a username, what does the variable look like afterwards in your system?
Thanks!
- Aug 27, 2021
Hello Alex.
Apply this iRule to your VS.
when ACCESS_POLICY_AGENT_EVENT { if { [ACCESS::policy agent_id] eq "format_username" } { ACCESS::session data set session.logon.last.username "[ACCESS::session data get "session.logon.last.username"].0" } }
Then configure an iRule Event box in your APM policy with ID "format_username".
Let me know if this works in your scenario.
Regards,
Dario.
- Aug 27, 2021
BTW, you can fix the issue with Variable Assign box using just the next syntax:
session.logon.last.username = "[mcget {session.logon.last.username}].0"
Regards,
Dario.
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