loadrunner Need Solution Friends... (unable to extract value from correlation...

  • perf-test.com need your contributions to build up a strong repository of performance engineering resources.

S

Sushil Kumar

Guest
Need Solution Friends... (unable to extract value from correlation variable to a file) char *filename = c:\\desktop\\temp.txt; long file; int i; ----- ----- count = atoi(lr_eval_string("{CITYNAME}")); for(i=1;ip>
 
If {CITYNAME} parameter contains a city name then how can you convert it from a string to a number using "atoi()"? Also lr_eval_string() API evaluates the string by replacing any parameter in {} with a real value.
 
char * filename = "C://NS_BVOIP_OpptyId_17Sep.txt"; char * filename1 = "C://NS_BVOIP_SolutionId_17Sep.txt"; long file,file1; if ((file = fopen(filename, "a+" )) == NULL) { lr_output_message("Unable to create %s", filename); return -1; } fprintf(file, "1-%s\n", lr_eval_string("{Siebel_row_id}")); fclose(file); //filename = "c:\\SolutionId.dat"; // Create a new file if ((file1 = fopen(filename1, "a+" )) == NULL) { lr_output_message("Unable to create %s", filename1); return -1; } fprintf(file1, "%d\n", atoi(lr_eval_string("{solutionid_01}"))); fclose(file1);
 
count = atoi(lr_eval_string("{CITYNAME}")); change this to count = atoi(lr_eval_string("{CITYNAME_count}"));
 
Include fclose(file) before you close the loop and it should work, also why are you opening the file every time in a loop , just open once then loop and close.
 
lr_eval_string("{CITYNAME_i}") is not equal to lr_eval_string("{CITYNAME__1}") even if i is 1. Use below code char strcity[100];//Define this in globals.h //Define this inside loop sprintf(strcity,"{CITYNAME_%d}",i); fprintf(file, %s \n, lr_eval_string(strcity));
 
Use below code it worked for me... char Length[10]; long file; char * filename="D:\\Cityname.txt"; file=fopen(filename,"a+"); sprintf(Length,"\n%s",lr_eval_string("{Cityname}")); fwrite(&Length, sizeof(Length),1,file); fclose(file);
 
I would answer, but I do not know which version of this thread is authoritative for response. The one in this forum or others. #StopCrossForumPosting
 
Thank u every one for ur valuable suggestions... My issue got resolved... I have used the below code.... file = fopen (filename, "a+") for(i=1;ip>