Re: Creating an array thru scripting


That is not what I asked. 

Suppose in OPL, I have the following tuple

A 1 

B 2 

D 5

K 9 


When I read data in excel, the rows might be in the following order.

K 9 8

D 5 7

A 1 19

B 2 4


Now, when I start reading CSV file, the first row is “K 9 8”, but I should select  A 1 19 as the first row and pass that into my array as [] =19.

I’d like to do this operation while reading the CSV file. 


Currently, I am using two inner for loop and if statement. In other words;

for(var i in OPLTuple)

  for(var j in CSVrows)

    if(i.first == j.first && i.second == j.first)

        myArray [ < j.first,  j.first>] = j.third



It runs extremely slow due to the size of my problem. Could you tell me if there is an efficient way of doing this operation in OPL?

Source: Re: Creating an array thru scripting