Forum Discussion

ganapati_bhat's avatar
ganapati_bhat
Occasional Contributor
10 years ago

need help regarding string check in if statement -Javascript

Hi,



I have a situation where i need to fetch the value from excel and need to check with value mentioned in the string and work on the application . Like,



var valueFromExcel='Male';



if(valueFromExcel=="Male"){

do something on the application

}

if(valueFromExcel=="Female"){

do something on the application

}



I am not able to check the value. My script is running for both male and Female.



Please help me regarding string equals using testComplete.

1 Reply

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Ganapati,


     


    The approach you can use depends on how you read data from Excel. If you are using DDT, something like this will work:




      DDT.ExcelDriver("C:\\MyFile.xls", "Sheet1");


      


      while (! DDT.CurrentDriver.EOF())


      { 


     


        If DDT.CurrentDriver.Value(0)=="Male" 


               // Perform something


        DDT.CurrentDriver.Next(); 


      }