The value of the variable is not updating
Hi,
I have a code below, I am retrieving the variable JobID from a string and then using the JobID in variable JobStatus. I have the JobStatus defined outside the while loop, initially it takes the correct value, but I am trying to update the JobStatus inside the while loop, but it's always displaying the same value it reads the first time. I have tried using Refresh() method with JobStatus and then trying to assign the Value, but nothing is working, JobStatus is not updating with new value. Please take a look at it.
function VerifyJob()
{
// Get the job id
var TempRecords = Sys["Process"]("C4")["WinFormsObject"]("C4Main")["WinFormsObject"]("panel1")["WinFormsObject"]("checkBoxAutoRefresh").Caption;
var ArrRecords = TempRecords.split(':');
var StrRecord = ArrRecords[4];
var ArrJobID = StrRecord.split(' ');
var JobID = ArrJobID[1];
// Check Job Status
var JobStatus = Sys["Process"]("C4")["WinFormsObject"]("C4Main")["WinFormsObject"]("panel1")["WinFormsObject"]("splitContainer1")["WinFormsObject"]("SplitterPanel", "", 1)["WinFormsObject"]("MainListView")["ListItem"](JobID)["Text"]("Job Status").Value;
var count = 0;
while(aqString["Compare"](JobStatus,"Done",false) != 0 && count != 15)
{
Delay(10000);
count++;
JobStatus = Sys["Process"]("C4")["WinFormsObject"]("C4Main")["WinFormsObject"]("panel1")["WinFormsObject"]("splitContainer1")["WinFormsObject"]("SplitterPanel", "", 1)["WinFormsObject"]("MainListView")["ListItem"](JobID)["Text"]("Job Status").Refresh();
JobStatus = Sys["Process"]("C4")["WinFormsObject"]("C4Main")["WinFormsObject"]("panel1")["WinFormsObject"]("splitContainer1")["WinFormsObject"]("SplitterPanel", "", 1)["WinFormsObject"]("MainListView")["ListItem"](JobID)["Text"]("Job Status").Value;
Log["Event"](JobStatus);
}
if(aqString["Compare"](JobStatus,"Done",false) == 0)
Log["Event"]("Job " + JobID + " has successfully completed");
else
Log["Error"]("Job " + JobID + " has not successfully completed");
}