Transform Columns Example (VB.NET)
[VB.NET]
' COPYRIGHT(C), SIMPLEXAR SOFTWARE LIMITED, 2006-2008.
' All rights reserved.
'
' Use of this copyright notice is precautionary only, and does not imply
' publication or disclosure. The content of this work contains confidential
' and proprietary information of Simplexar Software Limited. Any duplication,
' modification, distribution, or disclosure in any form, in whole, or in part,
' is strictly prohibited without express prior written permission.
' Get namespaces.
Imports System
Imports Simplexar.Statsar
Imports Simplexar.Statsar.Filters
' Start namespace.
Namespace Simplexar.Examples.Statsar
' This example uses the SheetFilter class to transform data.
' Two columns are combined to form a new column by using an expression.
Module Example
' The application entry point.
Public Sub Main()
Try
RunExample()
Catch exception As Exception
Console.WriteLine(exception)
End Try
Console.WriteLine("Press ENTER to terminate.")
Console.ReadLine()
End Sub
Private Sub RunExample()
' Create a calculator.
Dim calculator As New StatsCalculator()
' Use the calculator to load the sheet.
Dim sheet As DataSheet = calculator.Load( _
"..\..\..\..\..\Data\TestScores.csv")
Console.WriteLine(sheet)
' Suppose we wish to create a new data sheet with two columns:
' the student's name, and the total score. The two expressions
' we are looking for are: "Name" and "Total = English + French".
' The first expression means that we wish to select the student's
' name in the resulting sheet. The second expression uses the
' equality operator to mean that we wish to create a new column
' named "Total" which is equal to the sum of the English and
' French scores.
' Configure sheet filter.
Dim filter As New SheetFilter()
filter.Select("Name", "Total = English + French")
' Transform data to produce new sheet.
Dim transformSheet As DataSheet = sheet.Filter(filter)
Console.WriteLine(transformSheet)
End Sub
End Module
End Namespace