Combining variables in iRule (proper syntax)

Hi all,

I am working on the iRule where I need to dissect the URI query to extract value of the specific field (xyz). For example:

https://sitea.mycompany.com/login.aspx?abc=176560143&ClientNameSingleSite=xyz

I am able to set the target variable by doing the following:

set string [URI::query [HTTP::uri]]
set fields [split $string "="]
set name [lindex $fields 2]

however variable $name needs a “/” character added in the front of it to be matched against data group later.

I am not able to figure out the propper syntaxsys to do it all in one line so I i am setting a temp variable and then concatenating two string variables into one:

set temp "/"
set newname "$temp$name"

So,I am trying to eliminate two last lines and have $name variable set to contain “/” when variable is set initially. So far I have not been able to figure out the right way to do it, but I guess it should be something similar to this:

set name ["/"+[lindex $field 2]]

Can someone guide me on proper syntax for this.. Thanks.

I am not sure which one of these may suit your requirements but I am throwing a few options so you can try it out:

Can you try and use

set newname /$name

or

may be remove the / from the data group

or

use

append newname / $name

or

set newname /${name}

Hi,

the best way is to use the command URI::query:

set name [URI::query [HTTP::uri] ClientNameSingleSite]