Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Sheetwrite -> Range does not fit the dimensions of the array

    Posted 11/02/10 11:08 AM

    Originally posted by: G.L.


    Hi,

    I'm trying to write my results in a spreadsheet.

    Here is the part where things do not seem to work out:

    SheetConnection sheet("Results.xlsx");
    d to SheetWrite(sheet,"A1:Z500"); //The range here is bigger than what I need for the purpose of explaining the problem.

    d is dhttp://1..10http://1..72.

    If I give a range bigger than what I need, I get "Exception from IBM ILOG Concert: excel: range does not fit the dimensions of the array".

    I have to give a range which fits EXACTLY with "d" to make this work (i.e. 10 X 72).

    What I don't understand, is that in "help" on SheetWrite, they have this to say:

    "When using sheetWrite to write to named ranges, the size of the range does not have to match the size of the data you are writing to Excel. If the set is smaller, then only the top most cells will be filled.
    If you try to write more data than the range can accommodate, then you receive the error message: "Exception from ILOG Concert: excel: range is not wide enough to write the set"."

    I tried using a named range bigger than what I needed, and I get the exact same problem.

    Is there any way that I am NOT forced to "plan" the size of my results? Because "d" will NOT ALWAYS be 10 X 72.

    Thanks!

    Gabriel
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Sheetwrite -> Range does not fit the dimensions of the array

    Posted 11/05/10 10:08 AM

    Originally posted by: ArnaudS


    Hi,

    I think there is a bug.
    A workaround could be to do some thing like:

    .mod:
    {int} dim1 = {1,3,5};
    {int} dim2 = {1,2,3,4,5,6,7,8};
    int intArr[i in dim1][j in dim2] = i+j; 
    string rangeInExcel;
     
    execute {
            var str = "abcdefghijklmnopqrstuvwxyz";
            var d1 = dim1.size;
            var d2 = dim2.size;
            rangeInExcel = "A1:"+str.charAt(d2-1)+d1;  
    }
      
    dvar int i;
    subject to {
            i >= 5; 
    }
    


    .dat:
    SheetConnection sheet("e:\\sheet.xls"); 
    intArr to SheetWrite( sheet, rangeInExcel );
    


    Hope this helps,

    Arnaud
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Sheetwrite -> Range does not fit the dimensions of the array

    Posted 01/22/16 09:16 AM

    Originally posted by: Thomas_321


    Hey,

    I´m having a similiar problem. 

    Everytime I´m trying to solve my problem I get the error:

    "Exception from IBM ILOG Concert: excel: range does not fit the dimensions of the array".

    Maybe someone can explain what causes this error?

     

    Thank you very much


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Sheetwrite -> Range does not fit the dimensions of the array

    Posted 01/25/16 07:48 AM

    Hi,

    have you had a look at the example in

    opl\examples\opl\oil

    ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Sheetwrite -> Range does not fit the dimensions of the array

    Posted 01/26/16 09:21 AM

    Originally posted by: Thomas_321


    Hey, 

    thanks, I found the problem.

    I´d say it´s a rookie mistake, you just have to be sure that the arrays ranges are exactly the same. (like it says in the error message)

     

    Thanks for the help though.

     

    Best regards 

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: Sheetwrite -> Range does not fit the dimensions of the array

    Posted 03/19/16 04:57 PM

    Originally posted by: Sam85


    Hi,

    Am having the same issue, if you can help me out on how did you solve it please i would appreciate it

     

    Best regards

     

    Samar


    #DecisionOptimization
    #OPLusingCPLEXOptimizer