Reading from excel or .dat file

205 views
Skip to first unread message

GreatLuke

unread,
Oct 9, 2013, 3:36:41 PM10/9/13
to ai...@googlegroups.com
Hi,

Please I need help in using "ExcelRetrieveParameter" to read data from my excel file or .dat file. I tried to read on the question of other people and the answers provided but I could not get it correctly.
Please, I kindly need a clear step by step usage of it.

Thanks for your help.

Chris Kuip

unread,
Oct 10, 2013, 1:36:59 AM10/10/13
to ai...@googlegroups.com
Hi,


Hope this helps,

Chris.

Op woensdag 9 oktober 2013 21:36:41 UTC+2 schreef GreatLuke:

GreatLuke

unread,
Oct 10, 2013, 2:21:16 AM10/10/13
to ai...@googlegroups.com
I will go through it and get back.

Thanks

GreatLuke

unread,
Oct 10, 2013, 3:27:36 AM10/10/13
to ai...@googlegroups.com
Hi,

I have gone through the article on the link, and other related documentation, but I still get this error

ExcelRetrieveParameter(Myfile.csv, ParkingPermitIssued(k), A1:A6, Myfile, 0) failed: Actual cardinality (0) of domain #1 is smaller than specified cardinality (6).


and AIMMS could not retrieve from the excel file.

Please, someone should help me.

Thanks

GreatLuke

unread,
Oct 10, 2013, 3:50:05 AM10/10/13
to ai...@googlegroups.com
This is the code I wrote for it:

BLOCK
! this is the main part of the code



ExcelRetrieveParameter("Myfile.csv", ParkingPermitIssued(k), "A1:A6", "Myfile" ) ;
ExcelRetrieveParameter("Myfile.csv", NumberofSpaceAvailable, "B1:C6", "Myfile" ) ;
ExcelRetrieveParameter("Myfile.csv", NumberOfUsersInBuildings, "D1:E12", "Myfile" ) ;
ExcelRetrieveParameter("Myfile.csv", DistanceBtw, "F1:K12", "Myfile" ) ;


ENDBLOCK

Could anyone help me to put in right?

Chris Kuip

unread,
Oct 10, 2013, 4:03:25 AM10/10/13
to ai...@googlegroups.com
Hi,

It seems to me that the index k varies over an empty set; try filling that set first.

Hope this helps,

Chris.

Op donderdag 10 oktober 2013 08:21:16 UTC+2 schreef GreatLuke:

GreatLuke

unread,
Oct 10, 2013, 5:05:21 AM10/10/13
to ai...@googlegroups.com
Thanks Chris,

I was able to get for the first parameter (ParkingPermitIssued(k)) based on your advice but I could not get for the next one which is a two dimensional data.
This is the error I get:

ExcelRetrieveTable(Myfile2.csv, NumberofSpaceAvailable(i,k), B2:C7, B1:C1, , , 1) failed: The dimensions of the row and/or column array do not match the dimensions of data array.


And this is my code:

ExcelRetrieveTable( ExcelWorkbook : "Myfile2.csv",
                                  Parameter     : NumberofSpaceAvailable(i,k),
                                  DataRange     : "B2:C7",
                                  RowsRange     : "B1:C1",
                                  ColumnsRange  : "",
                                  AutomaticallyExtendSets : 1
                                 ) ;



And the data in my excel sheet is in this format:

reserved Unreserved
40 161
138 0
27 99
32 110
68 0
72 300



Thanks for your help.

GreatLuke

unread,
Oct 10, 2013, 11:44:53 AM10/10/13
to ai...@googlegroups.com
At last!!!, I was able to get it.

Thanks Man.
Reply all
Reply to author
Forward
0 new messages