Building a data table

Let us see, how to build a data table can be built. First, create an empty project. Give it a proper name:

  1. Drag and drop a Flowchart activity on the Designer panel. Also, drag and drop a Sequence activity and set it as the Start node.
  2. Double click on the Sequence and drag and drop the Build Data Table activity inside the Sequence activity.
  1. Click on the Data Table button. A pop-up window will appear on the screen. Remove both the columns (auto generated by the Build Data Table activity) by clicking on the Remove Column icon:
  1. Now, we will add three columns by simply clicking on the + symbol. Specify the column names and select the appropriate data types from the drop-down list.  Click on the OK button. We will add column Name of String Data Type, Roll_No of Int32 type and finally Class of string type:

Now enter some random values just to insert the data into the rows:

 

Click on the OK button and our data table is ready. We have to iterate over the data table's rows to make sure everything works correctly.

  1. In order to store the Data Table created by Build Data Table activity, we have to create a data table variable MyDataTable of DataTable type and in order to store the result of the data table that we have dynamically built. Also, specify  assign the Output property of the Build Data Table activity with this variable. Specify the data table variable's name there.
  2. After our data table is ready, we will iterate the data table's rows to make sure everything works correctly. Drag and drop the For each row activity from the Activities panel inside the Sequence activity. Specify the data table variable's name (MyDataTable) in the expression text box of the For each row activity:

 

  1.  Drag and drop the For each row activity from the Activities panel inside the Sequence activity. Specify the data table variable's name in the expression text box of the For each row activity:
For each and For each row are two different activities. For each is used to iterate over the collections, while the For each row activity is used to iterate over the data table rows.
  1. Drag and drop a Message box activity inside the For each row activity. In the Message box activity, Inside the message box we have to write following string: row("Name").ToString +"-"+ row("Roll_No").ToString + "-"+row("Class").ToString. row the variable which holding data for the data row in each iteration:

This row variable contains all the columns of a particular row. Hence, we have to specify which column value we want to retrieve by specifying the column name. Instead of the column name, we can also specify the column index (the column index always starts from zero). Hit the Run button to see the result.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.40.53