Printer FriendlyEmail Article Link

Avalanche: Is it possible to use search criteria with the same prefix and postfix or to capture values that are not the first occurrence?

Answer
  • Yes
     
  • From the Avalanche online help:

<...>
ASSIGN VARIABLE <string1 string2 string3 string4 integer1 integer2 variable_location>
(This search uses inline definitions of the prefix and postfix strings. Enter a name for the temporary search criteria file identified as string2. You do not need to create this file ahead of time.)
•string1 — the variable that is assigned the search result
•string2—temporary search criteria filename (automatically created by Commander)
•string3—prefix match
•string4—postfix match
•integer1 — postfix occurrence
•integer2—search criteria (pattern) occurrence
•variable_location —where you search: Header/Body/Both
<...>

  • Example 1: Test case goal is to capture each value between "amp;" and "amp;"

server response:
"<TransferID>/vodadi/test/ZZBB9999888800000001?BucketID=427&amp;OpenForWrite=0&amp;TransferRate=3750000&amp;ClientTransfer=60.240.2.46&amp;TimeStamp=1309950626.271&amp;TimeOut=5000&amp;MCSymbol=60817433.11.602643&amp;SubtypeOrFilename=index</TransferID>"

Client action list examples with results:
1 get http://192.168.1.1/
ASSIGN VARIABLE <var1 search1 "<TransferID>" "amp;" 1 1 BODY>           #var1 will get "/vodadi/test/ZZBB9999888800000001?BucketID=427&"
ASSIGN VARIABLE <var2 search2 "amp;" "amp;" 1 1 BODY>                          #var2 will get "OpenForWrite=0&"
ASSIGN VARIABLE <var3 search3 "amp;" "amp;" 1 2 BODY>                          #var3 will get "TransferRate=3750000&"
ASSIGN VARIABLE <var4 search4 "amp;" "amp;" 1 3 BODY>                          #var4 will get "ClientTransfer=60.240.2.46&"
ASSIGN VARIABLE <var5 search5 "amp;" "amp;" 1 4 BODY>                          #var5 will get "TimeStamp=1309950626.271&"
ASSIGN VARIABLE <var6 search6 "amp;" "amp;" 1 5 BODY>                          #var6 will get "TimeOut=5000"
ASSIGN VARIABLE <var7 search7 "amp;" "amp;" 1 6 BODY>                          #var7 will get "MCSymbol=60817433.11.602643&"
ASSIGN VARIABLE <var8 search8 "amp;" "</TransferID>" 1 7 BODY>          #var8 will get "SubtypeOrFilename=index"
1 get http://192.168.1.1/<apply var1><apply var2><apply var3><apply var4><apply var5><apply var6><apply var7><apply var8>

Avalanche will send this request:
http://192.168.1.1/vodadi/test/ZZBB9999888800000001?BucketID=427&OpenForWrite=0&TransferRate=3750000&ClientTransfer=60.240.2.46&TimeStamp=1309950626.271&TimeOut=5000&MCSymbol=60817433.11.602643&SubtypeOrFilename=index

  • Example 2: Test case goal is to capture bb and bb21cc to different variables

Server response: server response "1aa21bb21cc21dd21ee21ff2"
1 get http://192.168.1.1/
ASSIGN VARIABLE <myvar1 tempfile1 "1" "2" 1 2 BOTH>
#myvar1 = bb
ASSIGN VARIABLE <myvar2 tempfile2 "1" "2" 2 2 BOTH>
#myvar2 = bb21cc
 

  • Example 3: Test case goal is to capture value between second _ and first "

Server response: %3D002b307522f0_122264640001_947523ddfg3664f4e568afb9d08dx"
1 get http://192.168.1.1/
ASSIGN VARIABLE <myvar1 temp_search "%5f" "%22' 1 2 BODY>   
#hex values used for _ and " as double quotes cannot be used for in-line search criteria (e.g. """ results in a parse error however "%22" does not)
#myvar1 = 947523ddfg3664f4e568afb9d08dx

 


Product : L4-7,Avalanche,HTTP