User Tools

Site Tools


howtos:workwithdata:a_simple_import_view

This is an old revision of the document!


A Simple Import View

Update this when I finish the view templates article. FIXME

This simple view shows the import of three commonly used formats - tab-delimited text, comma-separated value (.csv) and the native tool format:

creview    emigration[s,ts1,a][]
creview    immigration[s,ts1,a][]
creview    mortality[s,ts1,a][]

integer $index
$index = 1
if $history == true
    $index = $index + 1
endif
if $background == true
    $index = $index + 1
endif

string $importDir
$importDir = $home + "/importData"

! default tab-delimited text file in odometer data format
emigration[s,ts1,a][$index] = import (; rowTitles=on, dataFile=$importDir/emigration.txt)

! comma delimited text file in coordinate data format
immigration[s,ts1,a][$index] = import (; format=coord, allCoord=off, delimiter=",", \
	dataFile=$importDir/immigration.csv)

! native TOOL format
mortality[s,ts1,a][$index] = import (; format=tool, dataFile=$importDir/mortality)

Automated Import View

Import views can also be automatically created out of Documenter. To do this:

  1. Select View Scripts → Import form the SAMM menu
  2. Activate the control checkbox (fixed variables cannot be changes and therefore are not relevant to import views)
  3. Click OK and then specify the location to save the .v and .t files.

Note that this process does not capture the necessary framework that indicates the locations of the data sources nor does it specify the correct data formats needed to read the data into the model. This all must be done manually.

howtos/workwithdata/a_simple_import_view.1308861403.txt.gz · Last modified: 2011/06/23 20:36 by chris.strashok