Forum Discussion

arjun_ta's avatar
arjun_ta
Contributor
12 years ago
Solved

DDTOBJECT

Hi,



I have connected the DDT driver to an excel present in my local,now how can i set the value lets say  DDT.CurrentDriver.Value(0)to a particular object.



for example my object name is



Sys.Process("Bedrock").Window("#32770", "Save As", 1).Window("DUIViewWndClassName", "", 1).Window("DirectUIHWND", "", 1).Window("FloatNotifySink", "", 1).Window("ComboBox", "", 1).Edit("File name:")



how can put the value present in DDT.CurrentDriver.Value(0) in the combobox or the edit box.



I am usin VB scripting.



Appreciate anyone's help on this.



Regards,

Arjun


  • Hi u have to create  ddt driver and use them in script



     Call DDT.ExcelDriver(filepath, Sheetname)



    Sys.Process("Bedrock").Window("#32770", "Save As", 1).Window("DUIViewWndClassName", "", 1).Window("DirectUIHWND", "", 1).Window("FloatNotifySink", "", 1).Window("ComboBox", "", 1).Edit("File name:").keys DDT.CurrentDriver.Value(0)



    for more details

8 Replies

  • murugans1011's avatar
    murugans1011
    Regular Contributor
    Hi u have to create  ddt driver and use them in script



     Call DDT.ExcelDriver(filepath, Sheetname)



    Sys.Process("Bedrock").Window("#32770", "Save As", 1).Window("DUIViewWndClassName", "", 1).Window("DirectUIHWND", "", 1).Window("FloatNotifySink", "", 1).Window("ComboBox", "", 1).Edit("File name:").keys DDT.CurrentDriver.Value(0)



    for more details
  • Thank you Murugan for the response. Its working.



    Regards,

    Arjun
  • Hi,



    How can i  perform the same above action for all the rows present in excel using DDT object.



    is there any DDTObject which stores the row value.if not how can i get the row value.



  • murugans1011's avatar
    murugans1011
    Regular Contributor


    While DDT.CurrentDriver.EOF=False



    'do needed operation here



    Call DDT.CurrentDriver.Next

    Wend

    Call DDT.CloseDriver(Driver.name)
  • murugans1011's avatar
    murugans1011
    Regular Contributor
    if u mean by the row header name u can use like this



    ColumnName = DDT.CurrentDriver.ColumnName(Index)

  • Hi murugan,



    Actually what i have to do is if my excel is



    name  number

    arjun   10

    nitin     11



    I want to fill the value arjun and 10 in two diffrent fields of the application during first iteration after that it it should jump to second row and it should fill the values present in second row.



    how can do this using DDT Objects.
  • Hi Arjun,

     


    Look into this sample taken from here:


     




    Dim RecNo


      


    ' Posts data to the log (helper routine)


    Sub ProcessData


      Dim Fldr, i


      


      Fldr = Log.CreateFolder("Record: " + aqConvert.VarToStr(RecNo))


      Log.PushLogFolder Fldr


      


      For i = 0 To DDT.CurrentDriver.ColumnCount - 1


        Log.Message DDT.CurrentDriver.ColumnName(i) + ": " + aqConvert.VarToStr(DDT.CurrentDriver.Value(i))


      Next


      


      Log.PopLogFolder


      RecNo = RecNo + 1


    End Sub


      


    ' Creates the driver (main routine)


    Sub TestDriver


      Dim Driver


      


      ' Creates the driver


      ' If you connect to an Excel 2007 sheet, use the following method call:


      ' Set Driver = DDT.ExcelDriver("C:\MyFile.xlsx", "Sheet1", True)


      Set Driver = DDT.ExcelDriver("C:\MyFile.xls", "Sheet1") 


      


      ' Iterates through records


      RecNo = 0


      While Not Driver.EOF


        Call ProcessData() ' Processes data


        Call Driver.Next() ' Goes to the next record


      WEnd


      


      ' Closing the driver


      Call DDT.CloseDriver(Driver.Name)


    End Sub




     


    Is this what you want?