moaly Absent Member.
Absent Member.
626 views

Vu Generator Parameters

HELLO,

i am trying to use a file parameter in Vu.

The file is a csv file.

it has two columns:

site,msg

 

Now the problem is the second column will contain a multiline value which means a text field that has newline and carriage return characters.

I enclosed my text in "" (double quotes). Still Vu is not able to interpret the carriage return character (\r\n).

it is giving me a file format error.

is there a way to save multilines parameters to be loaded correctly in LoadRunner?

 

my example input file looks like this:

 

Party,Msg
77880,"this is a text

that contains multiple lines

please call: 1-me

                      2- system admin

                      3- support admin"

i need to have the 'msg' as is formatted on multiple lines.

any ideas?

 

Thanks in advance

0 Likes
1 Reply
Absent Member.. DaveP_1 Absent Member..
Absent Member..

Re: Vu Generator Parameters

You may be able to use this code, modified to suit how you are using the data. Note that this is not dynamic, so you will need to know how many columns you have (although I'm sure it could be made it so).

 

//**********************************

/*

This is the contents of my parameter file:

pText

This is;Text;write it out;EOL

*/

int i;

char* token;

extern char* strtok(char *token, const char *delimiter);

i = 1;

token = (char *)strtok(lr_eval_string("{pText}"), ";");

while(strcmp(token, "EOL") != 0 )

{

// copy the sequence index string to a parameter and build the new parameter

lr_save_int(i, "cTmp");

lr_save_string(lr_eval_string(token), lr_eval_string("cLine_{cTmp}"));

token = (char *)strtok(NULL, ";"); // Get the next token

i++; // increment the counter

}

// Show output with some CRs and TABs

lr_output_message("%s\r\n\t\t%s\r\n\t\t%s", lr_eval_string("{cLine_1}"), lr_eval_string("{cLine_2}"),

lr_eval_string("{cLine_3}"));

/*

Output looks like this:

This is

Text

write it out

 

*/

//**********************************

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.