Forum Discussion

vthomeschoolmom's avatar
vthomeschoolmom
Super Contributor
7 years ago

Iterator IsEOF returning true ... I am certain I am doing something dumb

I have this code which is trying to loop through the rows of a table variable. 

var checkStaff = KeywordTests.InstructorInquirySmoke.Variables.Staff; var iterator = checkStaff.Iterator; var staffCode; iterator.Reset(); while(!iterator.IsEOF) { staffCode = iterator.Value(0); if (Staff.IsStaffExists()) { Log.Checkpoint("Instructor " + staffCode + " exists.", "", pmNormal, attr, Aliases.browser.pageMain.Picture()); } else { Log.Error("Instructor " + staffCode + " DOES NOT exist.", "", pmNormal, attr, Aliases.browser.pageMain.Picture()); } iterator.Next(); }

Iterator is not entering while loop. I am looking at checkStaff in debug watch. It (rightly) has 2 rows. iterator is showing as an object but with no details.

Can someone spy what I am doing wrong? I confess being the friday before a holiday I strongly suspect operator error.

 

  • Hi,

     

    According to the documentation and the code samples, .IsEOF() is a method, not a property.

    Have you tried

    while(!iterator.IsEOF())

    instead of your

    while(!iterator.IsEOF)

    ? Does it help?

     

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    According to the documentation and the code samples, .IsEOF() is a method, not a property.

    Have you tried

    while(!iterator.IsEOF())

    instead of your

    while(!iterator.IsEOF)

    ? Does it help?