I have scripted a web protcol based application flow where in I have to select 20 reports to download. The ReportIDs are shown in the request. I am customising the request so that the request picks up 20 Reports(ReportID) which are either EXCEL or CSV(ReportOutput) and the status is success(ReportStatus). I have captured the LR params thru traditional "wsrp" successfully with Ord=All and here is my logic
int i;
int count=0;
char ro_buffer[25],rs_buffer[25];
lr_save_string("","R_buffer");
for(i=0;i<=atoi(lr_eval_string("{ReportID_count}");i++)
{
sprintf(RO_buffer,"%s",lr_paramarr_idx(ReportOutput,i))
sprintf(RS_buffer,"%s",lr_paramarr_idx(ReportStatus,i))
if((lr_eval_string(ro_buffer)=="EXCEL" || lr_eval_string(ro_buffer) =="CSV") && lr_eval_string(rs_buffer)=="S")
{
count++;
if(count>20) break;
lr_param_sprintf("R_buffer","%s%s%2c",lr_eval_string("{R_buffer}"),lr_paramarr_idx(ReportID,i));
}
}
In the above code, vugen is not executing the code inside the if block even when the condition satisfies, that is, when the report output format is either "EXCEL" or "CSV" and report status is "S". Even from the server response I see the values deducing successfully as per the if block. I also used lr_param_sprintf syntax in place of sprintf but the situation is the exact same. But no use Not able to get what the missing point is.... Need help on this..
Four issues.
As a performance engineer take the hit outside of the for loop to cast the string to integer once. We should be engaging in performance best practices just like any other developer
The string your are building with sprintf() doesn't include the curly braces "{%s}" which are needed with lr_eval_string("{paramname}");
You have ro_buffer in your evalaution expression, but the sprintf() expression uses RO_buffer (notice upper case). Variables are case sensitive in C
Your expression will not work to compare two strings. Take a look at strcmp() - String Compare.....