To save parameter value to other parameter you have to:
- Evaluate value of initial parameter
Use lr_eval_string LoadRunner function. - Save the evaluated string to a second parameter
Use lr_save_string LoadRunner function.
// save string value to initial parameter
lr_save_string("some string value", "prmStr1");
lr_output_message(lr_eval_string("Value of prmStr1: {prmStr1}"));
// save the evaluated value to second parameter
lr_save_string(lr_eval_string("{prmStr1}"), "prmStr2");
lr_output_message(lr_eval_string("Value of prmStr2: {prmStr2}"));
Let's execute this code and check the result:lr_save_string("some string value", "prmStr1");
lr_output_message(lr_eval_string("Value of prmStr1: {prmStr1}"));
// save the evaluated value to second parameter
lr_save_string(lr_eval_string("{prmStr1}"), "prmStr2");
lr_output_message(lr_eval_string("Value of prmStr2: {prmStr2}"));
As you can see, both parameters (prmStr1 & prmStr2) have the same values - "some string value".
So, we assigned the parameter value to other parameter successfully.
Related articles:
- How to perform basic operations on LoadRunner parameters?
- Using parameters in Loadrunner VuGen script
- What are LoadRunner parameter and parameterization?
- How to get LoadRunner iteration number - using LoadRunner parameter?
- How to get LoadRunner iteration number - using global variable?
- All LoadRunner visual tutorials
Do you have questions on this topic - working with LoadRunner parameters?
Feel free to post them in comments.
--
Dmitry
4 comments:
Hi,
Is there a way in which we can store the value of a response parameter into an external file or table for all the iterations performed.
2Sumit:
Yes, there is a way. You have to save parameter value into file using C-functions.
Saving the parameter value into an external text file using C functions
str=lr_eval_string("{WCSParam_Diff1}");
if ((file = fopen(filename, "w+" )) == NULL) {
lr_output_message("Unable to create %s", filename);
return -1;
}
i = fwrite(str, strlen(str), 1, file);
if ( i > 0)
lr_output_message("Successfully wrote File");
fclose(file);
Hi Dmitry,
How can I send SAP GUI status bar value to Table type parameter dynamically.
sapgui_status_bar_get_text("paramStatusBarText", BEGIN_OPTIONAL, "Recorded status bar text: Purchase requisition number 0010000297 created",
"AdditionalInfo=sapgui1037",
END_OPTIONAL);
sapgui_status_bar_get_param("1", "PRNO", LAST);
lr_output_message(lr_eval_string("{PRNO}"));
how can I send this 'PRNO' to the below data_1 (table type parameter)
sapgui_table_fill_data("Table",
tblSAPLMEGUITC_12112,
"{data_1}",
BEGIN_OPTIONAL,
"AdditionalInfo=sapgui1043",
END_OPTIONAL);
Thanks and Regards,
Chinnadurai R
Post a Comment