gskerman
15 years agoNew Contributor
How do I force a list item collection to update
Hi,
I'm trying to check a list item for a state change. The item has parameters therefore waitproperty will not work, so I am using a while loop to check that the item state has changed.
However, testcomplete appears to cache the list object and is not detecting that the program has changed the property.
object.refresh(); is throwing an exception, and refreshing the parent list object is not updating the children. Am I missing something here?
function checkDraft()
{
var lst = Aliases["enDesign"]["MainForm"]["ToolStripContainer1"]["ToolStripContentPanel"]["DockPanel1"]["DockWindow"]["DockPane"]["PCList"]["SplitContainer1"]["SplitterPanel"]["fstLstPC"];
var lstItem = lst.Items["Item"](0)["RowObject"];
var StopWatchObj = HISUtils["StopWatch"];
StopWatchObj["Start"]();
while (StopWatchObj["Split"]() < 30000) {
if (lstItem["ReferenceLink"]["OleValue"] != '') {
KeywordTests["Test1"]["Variables"]["CheckDraft"] = true;
Log.message(VarToStr(lstItem["ReferenceLink"]["OleValue"]));
return;
}
Log.message(VarToStr(lstItem["ReferenceLink"]["OleValue"]));
lst.refresh(); // lst object is not refreshing
delay(500);
}
StopWatchObj["Stop"]();
KeywordTests["Test1"]["Variables"]["CheckDraft"] = false;
return;
}
I'm trying to check a list item for a state change. The item has parameters therefore waitproperty will not work, so I am using a while loop to check that the item state has changed.
However, testcomplete appears to cache the list object and is not detecting that the program has changed the property.
object.refresh(); is throwing an exception, and refreshing the parent list object is not updating the children. Am I missing something here?
function checkDraft()
{
var lst = Aliases["enDesign"]["MainForm"]["ToolStripContainer1"]["ToolStripContentPanel"]["DockPanel1"]["DockWindow"]["DockPane"]["PCList"]["SplitContainer1"]["SplitterPanel"]["fstLstPC"];
var lstItem = lst.Items["Item"](0)["RowObject"];
var StopWatchObj = HISUtils["StopWatch"];
StopWatchObj["Start"]();
while (StopWatchObj["Split"]() < 30000) {
if (lstItem["ReferenceLink"]["OleValue"] != '') {
KeywordTests["Test1"]["Variables"]["CheckDraft"] = true;
Log.message(VarToStr(lstItem["ReferenceLink"]["OleValue"]));
return;
}
Log.message(VarToStr(lstItem["ReferenceLink"]["OleValue"]));
lst.refresh(); // lst object is not refreshing
delay(500);
}
StopWatchObj["Stop"]();
KeywordTests["Test1"]["Variables"]["CheckDraft"] = false;
return;
}