• 1 reply
  • Latest Post - ‏2018-08-13T04:50:28Z by DanielJunglas
11 Posts

Pinned topic Dynamic reading

‏2018-08-12T20:24:11Z |

Hey Guys, 

i want to know if there any method, that make a dynamic reading, like for the oil example 

i want, if the size of an variable X=10 so :

Oil from SheetRead(sheet,"'oil data'!B2:E10");

And if X=15 then: 

Oil from SheetRead(sheet,"'oil data'!B2:E15");

Is there any idea how to do it ? 

Thank you

  • DanielJunglas
    3367 Posts

    Re: Dynamic reading


    You can do this with OPL script, I think. One way would be to dynamically create a .dat file and then read that file.

    Do you know an upper bound for X? Then you might do something simpler: Always read cells up to the upper bound into a temporary array and then transfer only the first X into the real array:

    float real_array[i in 1..X] = tmp_array[i];