Forum Discussion

royd's avatar
royd
Regular Contributor
7 years ago
Solved

Help needed with DDT script, error - "While is not defined"!

Hi every one,   Trying to create new patients from Excel sheet. It is not complaining about .xlsx  file (did some research and fixed it, I think). What I am getting now is "While is not defined"! I...
  • shankar_r's avatar
    7 years ago

    Hi,

     

    It is pretty common mistake. While should be while

    I hope New_Patients is a Unit name. if not that will also say undefined.

     

    function ddtD(){
    
      try
        {
          DDT.ExcelDriver("c:\\newPatients.xlsx", "femaileE");
    
          
          while (!DDT.CurrentDriver.EOF())
    	    {
    	      if (DDT.CurrentDriver.Value("Name") == "Lizzie Hari")
    	        {
    	          New_Patients.createPatients();
    	        } 
    	      DDT.CurrentDriver.Next();
    	    } 
        } 
        
        
        catch(exception)
        {
        Log.Error(exception.message);
        }
    
      DDT.CloseDriver(DDT.CurrentDriver.Name);
    }

     ref:https://www.w3schools.com/js/js_loop_while.asp