Forum Discussion

daljitm's avatar
daljitm
Occasional Contributor
15 years ago

if...then and else statements

Hi,



does anyone know why, Testcomplete does not run my Else statement when my if...then statement it is preceeded by returns a false value, I have made sure these statements are on the same level...?
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    It might help to know what condition you're testing.  If you're looking for whether or not a window exists, you should make sure that, in your conditional, you use a "Wait" method like "WaitWindow" or "WaitVCLObject" or something like that.  Otherwise, Window().Exists will fail with an error because Window() cannot be resolved and so calling the Exists property won't work.
  • daljitm's avatar
    daljitm
    Occasional Contributor
    hmm im lookin at a text value, if status field = approved then log out of website, Else launch another (backoffice) application. hope that explains it better...
  • karkadil's avatar
    karkadil
    Valued Contributor
    Post here the function you have problems with and specify where exactly you have problems and what you are expecting to be
  • I created a data driven script but I am unable to create if then statement from values of excel sheet. Pleae help me how can if use if then statement using excel sheet.
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Naz,


     


    What exactly doesn't work? You can check the value of the cell in the following way:




    ...


    While Not DDT.CurrentDriver.EOF()


        If aqConvert.VarToStr(Driver.Value(0)) = "some value" Then


           ' do something


        End If


        DDT.CurrentDriver.Next()


    Wend


    ...