2

I have one script in HP-LoadRunner, I want to take multiple values of column in a single field.

I have this:

Variable1

test1

test2

test3

test4

I am trying to do this:

Variale1

test1,test2,test3,test4

I tried with writing a 'C' code to solve this but unfortunately not able to find proper solution.

Is this possible with writing a code it will change into single column field during 1st test run and take the values from that single column field ?

Kindly Help me out, Either in terms of writing 'C' code in script or something to change in Excel/.dat file.

Aliaksandr Belik
  • 12,725
  • 6
  • 64
  • 90
Satish Shihani
  • 469
  • 3
  • 17
  • Your question is unclear. Please clarify if you are trying to feed data into a field from a file representing user input or if you are trying to capture data from the screen/server to use later in the same business process – James Pulley Sep 21 '15 at 12:55
  • 1st time when i am running Loadrunner script, then i am taking parameter values from one file which i showed in given " I have this: " ......and i am passing it in a request...... then again i want to write those fetched values into new file in the form of given " I am trying to do this " – Satish Shihani Sep 21 '15 at 13:27
  • "....then again i want to write those fetched values into new file ...." See Virtual Table Server. – James Pulley Sep 22 '15 at 13:32

2 Answers2

1

I think I faced the same problem so Try this:-

 long fp;
 int i,j;
 char *SearchValue;
 char ch[10];


Action()
{
   fp=fopen("External file path","w");      

   for(i=1;i<=5;i++)
   {
   fputs("\"",fp);
   fputs(lr_eval_string("{Internal file parameter}"),fp);               

   for(j=1;j<=10;j++)
    {
        fputs(",",fp);
        fputs(lr_eval_string("{Internal file parameter}"),fp);
     }

    fputs("\"",fp);

    fputs("\n",fp);                     
   }
   fclose(fp);

    return 0;
}
0

This solution will help you if your "Variable1" appears only once in your script. In your script while replacing the parameter, instead of using "{Variable1}" use "{Variable1},{Variable1},{Variable1},{Variable1}" and in your parameter settings provide "update value on: each occurrence".

Karthick PKa
  • 114
  • 6
  • Thanks @Karthik, Your answer was helpful little bit, I was applying loop as you given me an idea and finally saurabh dadhich posted full code with answer. – Satish Shihani Sep 23 '15 at 09:07