Forums

Silk Test

Master the automation of complex technologies for your most critical applications.

Each time I save data in an ActiveData the last data is overwritten.

This question is answered

I have this problem when different values are being saving in the same ActiveData. The ActiveData was created with some rows in order to save data in each row. For example we want to save Name, Last Name, Address and Post Code each value in each row. In PlayBack time, data that remains in ActiveData is Post Code in first row.

I would like to know how to save data in different rows without overwritten first data and if it is necessary to specify a number of rows or ActiveData is dynamic.

Verified Answer
  • Hi,

    Please confirm that whenever you add row into active data, you have  created and add a new row i.e

    Dim row As ActiveDataRow = data.AddRow()

    data.AddRow() will add new data row into actrive data.

    Also confirm that that you have saved that data using

    data.Save() method.

    E. g.

    Public Sub Main()

    InsertNewNumberToDataFileWithOccupation( 108, "Jay", "Jones", "5551219", _

       "QA Analyst" )

    End Sub

    Public Sub InsertNewNumberToDataFileWithOccupation( id As Integer, _   firstName As String, lastName As String, phoneNumber As String, _

       occupation As String )

    Dim data As ActiveData = Workbench.LoadActiveData( "PhoneBookData" )

    Dim row As ActiveDataRow = data.AddRow()

    row.SetLong( "id", id )

    row.SetString( "fname", firstName )

    row.SetString( "lname", lastName )

    row.SetString( "number", phoneNumber )

    row.SetString( "occupation", occupation )

    data.Save()

    End Sub

    Rajashri Jadhav

All Replies
  • Hi,

    Please confirm that whenever you add row into active data, you have  created and add a new row i.e

    Dim row As ActiveDataRow = data.AddRow()

    data.AddRow() will add new data row into actrive data.

    Also confirm that that you have saved that data using

    data.Save() method.

    E. g.

    Public Sub Main()

    InsertNewNumberToDataFileWithOccupation( 108, "Jay", "Jones", "5551219", _

       "QA Analyst" )

    End Sub

    Public Sub InsertNewNumberToDataFileWithOccupation( id As Integer, _   firstName As String, lastName As String, phoneNumber As String, _

       occupation As String )

    Dim data As ActiveData = Workbench.LoadActiveData( "PhoneBookData" )

    Dim row As ActiveDataRow = data.AddRow()

    row.SetLong( "id", id )

    row.SetString( "fname", firstName )

    row.SetString( "lname", lastName )

    row.SetString( "number", phoneNumber )

    row.SetString( "occupation", occupation )

    data.Save()

    End Sub

    Rajashri Jadhav