IndexMapping3.gms : SQL2GMS Example 6 - Index Mapping done in GAMS

Description

This example shows how to map index names if the names in the
database are different from the ones in the GAMS model.

This model is referenced in "Example 6 - Index Mapping" section "Index Mapping
done in GAMS" from the SQL2GMS Documentation.

Keywords: SQL2GMS, data exchange, GAMS language features


Category : GAMS Data Utilities library


Main file : IndexMapping3.gms   includes :  Sample.accdb  IndexMapping3.gms

$title SQL2GMS Example 6 - Index Mapping done in GAMS (IndexMapping3,SEQ=051)

$onText
This example shows how to map index names if the names in the
database are different from the ones in the GAMS model.

This model is referenced in "Example 6 - Index Mapping" section "Index Mapping
done in GAMS" from the SQL2GMS Documentation.

Keywords: SQL2GMS, data exchange, GAMS language features
$offText

$callTool win32.msappavail Access
$if errorlevel 1 $abort.noError "No Access available"

Set i / NY, DC, LA, SF /;

Set idb 'from database' / 'new york', 'washington dc', 'los angeles', 'san francisco' /;

$call sql2gms C="DRIVER=Microsoft Access Driver (*.mdb, *.accdb);dbq=.\Sample.accdb" B O="city1.inc" Q="SELECT City, [Value] FROM [example table]" > %system.nullfile%
$ifE errorLevel<>0 $abort Error using SQL2GMS!

Parameter dbdata(idb) /
$include city1.inc
/;

Set mapindx(i,idb) / NY.'new york', DC.'washington dc', LA.'los angeles', SF.'san francisco' /;

Parameter data(i);
data(i) = sum(mapindx(i,idb), dbdata(idb));
display data;