Forum Discussion

kingk's avatar
kingk
New Contributor
4 years ago

Complex Data Correlation Rules

LoadComplete is new to me and Regex has always been a nemesis of mine.  I'm trying to determine if the below Data Correlation Rule I need is possible, or if I need to create many Data Selectors & Data Replacers, and recreate their values each time a new recording is made.

My Scenario has multiple instances of variables which are provided in response bodies using parameter names that do not match the names used in the subsequent requests where this data is used.


The "Working With Subexpressions" documentation shows that:
       -A variable name in the "Find names and extra attributes" section can be set to the to the value of a regex subexpression.  So, the ""ClientExchange":"(.*?)"" regex using "$1" would create a variable by the name of "8c2edc663f41c388429277224fa16da3"
       -That variable can then be used in the "Select from Responses" section using the same ""ClientExchange":"(.*?)"" regex, again using "$1" to set the value of "8c2edc663f41c388429277224fa16da3" to "5q813b9c3e969bc5bfb8f42d80a7bdf4".

However, I don't understand how to get the "Replace in requests" section to provide the desired outcome.

 

Example:

   Use data from ClientExchange parameter from Response Body of request 102:

      Recorded: "8c2edc663f41c388429277224fa16da3":

            - Actual string where value is extracted from: "{"ClientExchange":"8c2edc663f41c388429277224fa16da3"}"

      Simulated: "5q813b9c3e969bc5bfb8f42d80a7bdf4"

   To replace in TransactionId value in Request Header:

      Where the Recorded value is: "8c2edc663f41c388429277224fa16da3"

      With the Simulated value of: "5q813b9c3e969bc5bfb8f42d80a7bdf4"

 

Any recommendations on how to go about creating a Data Correlation Rule that would work in my example scenario?

  • Hi,

     

    Can you share an example scenario? We'll try to create an auto-correlation rule based on it.

     

    Thanks!

  • AlexeyKryuchkov's avatar
    AlexeyKryuchkov
    SmartBear Alumni (Retired)

    Hi,

     

    Can you share an example scenario? We'll try to create an auto-correlation rule based on it.

     

    Thanks!

    • kingk's avatar
      kingk
      New Contributor

      Hi Alexey.  It seems this was not complex after all.  Thank you for your response.

       

      Below is the resulting Data Correlation Rule:

      Body (RegExp)

      "pxClientExchange":\s*"([^"]+?)"

      $1

       

      Header (Path)

      Request/Query/pzTransactionId