IndexMapping3 : Index mapping in GAMS code
This example shows how to map index names if the names in the
database are different from the ones in the GAMS model.
Files: Sample.mdb IndexMapping3.gms
$ontext
This example shows how to map index names if the names in the
database are different from the ones in the GAMS model.
$offtext
set i /NY,DC,LA,SF/;
set idb 'from database' /
'new york',
'washington dc',
'los angeles',
'san francisco'
/;
parameter dbdata(idb) /
$call =sql2gms C="DRIVER={Microsoft Access Driver (*.mdb)};dbq=Sample.mdb" o="city1.inc" q="select City,[Value] from [example table]"
$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;