If your application has multiple transactions, each transaction has its unique transaction ID. The transactions can be differentiated by their transaction names, and their transaction IDs shall be assigned with different parameters, so that each parameter will correlate with its own transaction.
-
Add scripts in the Connect for capturing the transaction ID and assign it to a parameter.
A ConnectAndCreateTransaction request in a transaction named “itr_dynamiccon” looks like the following:
web_custom_request("ConnectAndCreateTransaction_2", "URL=http://192.168.178.125:5001/api/ServerApi/ConnectAndCreateTransaction", "Method=POST", "Resource=0", "RecContentType=application/json", "Referer=", "Snapshot=t337.inf", "Mode=HTTP", "EncType=application/json;charset=UTF-8", "Body={\"version\":\"1.0\",\"requestid\":\"5D86818C-CAF5-49fe-B78A-4AC7AC550F88\",\"appname\" :\"psapi4loadrunner\",\"namespace\":\"Psapi4loadrunner\",\"session\":\"""<gs_SessionID>\" ,\"type\":7,\"transaction\":null,\"content\":{\"connect""\":{\"cachegroup\":\"\",\"cachename\ ":\"PostgreSQL\",\"transactionname\":\"itr_dynamiccon\",\"params\":\"""eyJ0aW1lc3RhbXAiOjE2Mj UyMDg5MTEsInBheWxvYWQiOiJna21qUzVZY01RM294ZnJLVFNQQ1NyRFJuUENqTmxPTHZEeENGUlJ0MngrNW1WV3d2WFJ NK3BCalRiMEFKY05EZm5iMFU5VVQ0ckhjdnRRQ0tubkV1Q29adlhoOExlRXZvaFhsSGJlMmQ1cFdRZzc2VnhLOGYwZHZl SDBGMVRBRTB6YU9zaEhuM2lKMGZEQkJSak1scXl1MThyUnM0OFlOY3dlMGY2ZGpHbWVvUGxmVU40RzM0MTcwMCtzbUh3U ng5ZUlIcnUvR2pRS0hkYmFFRWJyMlAxR2tMZVg4UE1wVlVtZTh5ektJWlRZZUVkSFBtd3crekpLNlJFeE9QMFFKVVdIVW 4wajFKemh0MURYcW95VjlKMjJyam5CNVk3U1dBYy91UnRlQkxmUT0iLCJzaWduYXR1cmUiOiIyT2t2SGRIaWtoWGZzeXQ vSHNhSUk4R3VzQj""M5OXJmbER1YzdTWEpkNjg1bDlxUjJJbkpzRGVVbTcxdVl6WHh0UGZFeTFGTFUzcDRjRWNWK2p1YW F0UT09In0=\"}}}", LAST);
You need to add the following code above the ConnectAndCreateTransaction request:
-
Add a web_reg_save_param function above the request to capture the transaction ID and assign it to the parameter “gs_TransactionID_Dycache”. Here the parameter name has a suffix “_Dycache” to identify the transaction “itr_dynamiccon”.
web_reg_save_param("gs_TransactionID_Dycache","LB=\"transactionid\":\"","RB=\"},\"content","Search=Body",LAST);
-
-
Replace the transaction ID with the parameter every time it occurs.
-
Identify the transaction ID that needs to be correlated. You may do a global search in the script for the transaction name “itr_dynamiccon” which follows the transaction ID.
-
Replace every occurrence of the transaction ID with the parameter <gs_TransactionID_Dycache>.
web_custom_request("RetrieveWithParm", "URL=http://192.168.178.125:5001/api/ServerApi/RetrieveWithParm", "Method=POST", "Resource=0", "RecContentType=application/json", "Referer=", "Snapshot=t338.inf", "Mode=HTTP", "EncType=application/json;charset=UTF-8", "Body={\"version\":\"1.0\",\"requestid\":\"81EDB9E2-CC47-4b68-B70A-09B46DD88261\",\"appname\":\ "psapi4loadrunner\",\"namespace\":\"Psapi4loadrunner\",\"session\":\"""<gs_SessionID>\",\ "type\":1,\"transaction\":{\"transactionid\":\"""<gs_TransactionID_Dycache>\",\"transactionname\" :\"itr_dynamiccon\"},\"content\":{\"retrieves\":[{\"retrieveid\":\"81EDB9E2-CC47-4b68-B70A-09B46 DD88261\",\"parent\":\"\",\"dataobject\":\"d_customers\",\"parentcolumn\":\"\",\"isreport\":false, \"isdynamic\":false,\"dwsyntax\":\"\",\"sql\":\"\",\"processing\":1,\"arguments\":[]}]}}", LAST);
-