Forum Discussion
Thansk Alot martin. I think thats what happening.can you please check with while loop: i am getting error: grid column index 112 is out of bounds
var i=Grid.wRowCount-1;
var Foundrow=Grid.FindRow(i,"Created date");
While(Foundrow!=-1)
{
var dateString = Grid.wValue(i, "Created Date");
if (aqString.Find(dateString, FormatStr, 0, false) != -1) {
Grid.ClickCell(i, "Created Date");
dockedBarControl.ClickItem("Delete");
Form5.Click(105, 12);
Form5.SimpleButton.ClickButton();
Foundrow=Grid.FindRow(i,"Created Date")
}
else log.Error(" no row Found")
}
First parameter of FindRow is the Column indicator. So, you can't use "i" in the first parameter of FindRow.
You are going to need to write some VERY fancy code find the first instance of the desired date, reset the index of the loop, and repeat until all required dates are found. I MIGHT be a for loop after all... but I'm thinking it might be a while loop.
- tristaanogre6 years agoEsteemed ContributorHere's my best guess. This is untested but is probably the best logic. Basically, we have a while loop that we'll keep on repeating until we no longer find a date to delete. Then, in the while loop, we scan the grid to find the first instance of that date, then delete it. Then, we go back to the top of the while loop and repeat. Off the top of my head, this is the best guess I have.
grd.ClickItem("Edit"); var continueLoop = true; var foundRow; while(continueLoop){ foundRow = -1; for(i=0;i<=Grid.wRowCount-1;i++){ // Loop through to find the first desired date var dateString = Grid.wValue(i, "Created Date"); foundRow = aqString.Find(dateString, FormatStr, 0, false) // if we find one, break out of the for loop. If we don't, we continue the for loop. foundRow will be -1 if nothing is found if ( foundRow != -1) { break } } //if foundRow is not -1, then we do our delete stuff and continue the while loop if (foundRow != -1) { Delay(1000) Grid.ClickCell(i, "Created Date"); Control.ClickItem("Delete"); Form5.Click(105, 12); Form5.SimpleButton.ClickButton(); Delay(1000); continueLoop = true; } //if we get out of the for loop and foundRow is still -1, indicate to no longer continue the while loop else continueLoop = false; }
Related Content
- 5 years agouser2