NewEra: copying rows between SuperTables
Posted in 1995
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL, Clustering, Grid & MACH11
Hi folks. We've started a pilot project in NewEra and have been making reasonable progress, but we've come across a nasty problem. A common situation in our application (which is derived on a 4GL system) is having pairs of screen forms/windows which show the same type of records, one form showing a detailed view of a single record and one showing summary info for a dozen or so records. To emulate this in NewEra, we've got two SuperTables sharing the same window, one free-form and one grid, only one of which is visible at any one time. What we need to do is be able to navigate through the same of rows using either SuperTable. The problem is that the SuperTables each have their own sets of rows, which are populated by that SuperTable's member functions. We want to only retrieve one set of rows from the database, for obvious time & space reasons, but then have both SuperTables deal with that data. Our first solution was to retrieve into the grid ST, since fast response is more important when you're looking at multiple records. This also reduces the problem to a simple one-row-copy idea, ie to change rows in the freeform ST, copy the required row from the grid ST. The basic problem here is that the only method of copying we've found to work is too slow. We used the "approved" method of changing data programmatically, setCellValue(), as follows: { This is simplified code; there's more stuff to do with handling STs having different column orders, but it isn't necessary here. } for col_nbr = 1 to nbr_fields let ok = destST.setCellValue( newStrVal : (sourceST.getCellValue(colNum:col_nbr)).getValueStr(), rowNum : ixSuperTable::currentRow, colNum : col_nbr) end for Like I said, it works but it's slow; about 3/4 second to change rows on the freeform ST (about 20 fields), and this is the culprit. The other main effort we put in was to use getRowByNumber(). Since the help _warns_ that this is the "actual ixRow used to store data in the SuperTable", we thought we'd try something like this: let display_mode = sourceST.getDisplayMode() let source_row = sourceST.getRowByNumber(displayMode:display_mode) for i = 1 to nbr_fields let old_value = destST.getRowByNumber(displayMode:display_mode).setVal( elem:source_row.getVal(i), colNum:i) let new_value = destST.getRowByNumber(displayMode:display_mode).getVal(i) display "new value ", i, new_value.getValueStr(), " or ", dataWN.viewST.getCellValue(colNum:i).getValueStr() end for This compiles, runs quickly, the debugging shows the correct new data using both methods (getVal or getCellValue) but...it doesn't update the screen. You can move through the rows on the freeform ST and the row counter updates, the position & display in the grid ST is correct & complete (when you switch back) but none of the freeform ST fields display any data. So...how are you supposed to do this ? Is the getRowByNum() approach doomed, or are we doing it wrong ? Can we make them share a set of ixRows ? Help ! Thanks (hopefully) -- Ian Macdonald, ikm@labsys.com.au Phone +61 03 894 2500 Laboratory Systems, Melbourne, Australia. Fax +61 03 894 3338