Example 1: Component table querying a CSV file

Previous Next

This example shows how to create a component table that returns data from a CSV file as if it were a database table with multiple rows: a component table mimics the behaviour, or part of the behaviour of a database table but is not itself in the database.

The component table uses an underlying .NET component that uses the query protocol to interpret file contents as a multi-row data set.

The example component expects a .CSV input file with the following structure: ID, DESTINATION, TOUR_TYPE, START_DATE, END_DATE, PRICE.

 

Example

Here is an input file called C:\Temp\schedtour.csv that demonstrates the data format expected by the example component:

146,AUSTRALIA,ISLAND SUNTANNER,21-3-2020 11:59:01,1-4-2020 11:59:01,2500

145,AUSTRALIA,ISLAND SUNTANNER,20-11-2019 11:59:01,1-12-2019 11:59:01,2500

144,BRAZIL,RAINFOREST RIDE,16-10-2021 11:59:01,29-10-2021 11:59:01,3000

143,BRAZIL,RAINFOREST RIDE,15-9-2021 11:59:01,28-9-2021 11:59:01,3000

142,BRAZIL,RAINFOREST RIDE,15-8-2021 11:59:01,28-8-2021 11:59:01,5500

 

 

collapseStep 1: .NET component for retrieving data from a CSV file
collapseStep 2: Query protocol association
collapseStep 3: Testing the query protocol
collapseStep 4: Component table
collapseStep 5: Testing the component table

 

 

See also

Example 2: Component table querying multiple CSV files

Query protocol