Highlighted
Trusted Contributor.
Trusted Contributor.
256 views

DoWhile not looping

Can anyone explain what I'm missing? The request exceutes with no errors but the eval never happens. The do does but the while does not. 

do
{
lr_start_transaction("DataChunkingStatusCheck");

web_custom_request("DataChunkingStatusCheck",
"URL=http://[URL]/BI/ABSBI/ABSBIWEB.dll/DataChunkingStatusCheck",
"Method=POST",
"Resource=0",
"RecContentType=text/html",
"Referer=http://[URL]/BI/",
"Snapshot=t9.inf",
"Mode=HTML",
"EncType=application/json;charset=utf-8",
"Body=%7B%22server%22%3A%2210.6.33.27%22%7D&[Poll_ID]&",
LAST);

lr_end_transaction("DataChunkingStatusCheck", LR_AUTO);

lr_output_message("%s", lr_eval_string("[DataChunkStatus]"));

//Convert parameter string to Json format
lr_eval_json("Buffer=[DataChunkStatus]","JsonObject=json_datachunk", LAST);

lr_output_message("%s", lr_eval_string("[DataChunkStatus]"));

//Query the string for the accessToken field
lr_json_get_values("JsonObject=json_datachunk","QueryString=$.requestStatusText","ValueParam=DataChunkStatus",LAST);

lr_output_message("%s", lr_eval_string("[DataChunkStatus]"));

lr_think_time(5);

}while (lr_eval_string("[DataChunkStatus]") == "RUNNING");

0 Likes
1 Reply
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: DoWhile not looping

I think I might see what's happening here.

Short version. Strings don't exist in C the way we think of them. They are constructed as arrays of chars, null terminated. What you're really comparing there is two pointers. And they will likely never be the same.

Investigate the strcmp() function. instead of using "==".

http://en.cppreference.com/w/c/string/byte/strcmp

Though I assume the loop body is definitely executing once?

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.