-------- Forwarded Message --------
From: [email protected]
To: [email protected]
Subject: Read Excel data into subscripted set
Date: Fri, 26 Oct 2012 14:46:44 +0200

Hi,

I have troubles with reading a 2-dimensional table in MS Excel and
putting the data into a subscripted set. In a first step, I try to read
a 2-dimensional table and fill its data into a 2-dimensional parameter.
The example from the AMPL book pp.196-197 (can be found online:
http://www.ampl.com/BOOK/CHAPTERS/13-tables.pdf) describes exactly this
situation. It uses the diet problem to demonstrate, how the parameter
amt (param amt {NUTR,FOOD} >= 0) can be read from MS Excel by 
table dietAmts IN "ODBX" DIET2D.xls":
[i ~ NUTR], {j in FOOD} <amt[i,j] ~ (j)>;



Since the database connection in GMPL looks a little bit different, I
adopted my working command for reading in the data of a 1-dimensional MS
Excel table to the 2-dimensional case like that:
table dietAmts IN 'ODBC'
  'DRIVER={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm,
*.xlsb)};dbq=.\test.xlsx'
  'SELECT * FROM [Tabelle2$]' :
  [i ~ NUTR], {j in FOOD} <amt[i,j] ~ (j)>;

Putting everything together in one model file (why the table definition
needs to be before the data part, I still do not understand..), Gusek
gives me an error message:
syntax error in field list
Context:  , FOOD } >= 0 ; table dietAmts IN '...' '...' '...' : [ i ~
MathProg model processing error

I would appreciate every help!

Regards,
Christian



_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to