Scripting - IDataSet

  • 86 Views
  • Last Post 26 June 2018
  • Topic Is Solved
John_TheGuy posted this 26 June 2018

Hello, 

I have made a DataSet inside Flexicapture called "ItemsToChange". I've added in 3 columns and inserted 5 rows. 

I now want to create a script in C# .NET to access the 5 rows I created. I have figured out how to get the total rows inside the DataSet but I'm not able to get the values. I've read the help file on the website and that didn't help. I also have been trying to find an example, but failed to do so. 

 

If possible can you please provide an example of how you would do this.

 

How I'm accessing the DataSet = 

IDataSet ds = Context.DataSet("ItemsToChange");

IDataSetQuery dsQuery = ds.CreateQuery();

int RecordsInDs = ds.GetRecordsCount(dsQuery);

//Loop through the DataSet to retrieve rows

for(int i = 0;i < RecordsInDs;i++)

   IDataSetRecord dsRecord = ???

AlexeyEfremov posted this 26 June 2018

Hello,

Here is the sample code:

DataSet dataSet = Context.DataSet("ItemsToChange");

IDataSetQuery query = dataSet.CreateQuery();

IRecordset recordSet = dataSet.GetRecords(query);

for (int i = 0; i < recordSet.Count; i++)

{

    record = recordSet.GetRecord(i);

    string fullName = record.GetValue(0).ToString();

}

Close