User Tools

Site Tools


howtos:workwithdata:a_simple_import_view

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 from 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:

  • This process does not capture the file path that indicates the location(s) of the data source(s) nor does it specify the correct data format(s) needed to read the data into the model. This all must be done manually.
  • The file generated will represent the node currently selected in Documenter. If the root node is selected all of the control variables will be included in the import view. If a calculator is selected only the variables associated with that calculator will be used.
howtos/workwithdata/a_simple_import_view.txt · Last modified: 2011/06/23 20:41 by chris.strashok