From: Staffan T. <sta...@gm...> - 2014-11-19 11:16:11
|
Roger, >From reading your problem description I BELIEVE that one of the issues you are having is that your are trying to use stem variables in place of array objects. An array in ooRexx is an object of the .Array class. So the resulting 'data' variable in example "data = dbConn~exec(sql,.true)" is in fact an array-of-arrays. Therefore data[1] is an array of column names, which could be logically created using a statement such as data = .Array~new data[1] = .Array~of('col1','col2','col3') Then data[2] through data~items also contain arrays with the actual data, logically created as this: data[2] = .Array~of(col1row1,col2row1,col3row1) data[3] = .Array~of(col1row2,col2row2,col3row2) etc So building the columns is a simple matter of scanning the array in data[1], for example: width=50 do i = 1 to data[1]~items lv~insertColumn(i-1, data[1][i], width) end And to insert the data you can use addRowFromArray: do i = 2 to data~items lv~addRowFromArray(data[i]) end If you are not familiar with the collection classes in ooRexx I suggest you read up on these in the ooRexx documentation. I hope this can be of some help. Staffan |