Forum Discussion

s6d's avatar
12 years ago

Database Table Checkpoint - parametise table name

Hi,



We are trying to use a Database Table Checkpoint (i.e. DBTables.Table1.Check) to check a file against an Excel spreadsheet.



This works for one file, but we would like to parametise "Table1" so that as we iterate through a loop, a different source file will be used each time.



Examples of our attempts which haven't worked (to give some idea of what we are trying to achieve!)



DBTables.KeywordTests.Test1.Parameters.Table.Check



DBTables(KeywordTests.Test1.Parameters.Table).Check



var1 = "DBTables." & KeywordTests.Test1.Parameters.Table & ".Check"

Call var1



This is to be used as an enhancement to a DDT.Excel Driver we are currently using.



Any help would be appreciated!



Thanks,



Stuart
  • gid_216's avatar
    gid_216
    Frequent Contributor
    Hi Stuart,



    As per my knowledge, DBTable snapshots canot be parameterized (I may be wrong).

    Why don't you

    1. create a separate function that will give you the db snapshot as a recordset object

    2. another one that will validate you excel with the recordset retrieved.

    3. Call the first method in side the second one and use the second one in your keyword test.



    The same steps you can follow for Keywords also.


  • Hi Stuart,


     


    What script language are you using? 


    I suppose that using the eval function (JScript) may help you. Here is the small example:




      //JScript


      var obj = "XML.XmlCheckpoint2";


      eval(obj).Check("Path To The File");




     


    Another script language should have a similar function.