Pages

Monday, 8 March 2010

EditTable Cookbook - Handling Large Arrays

Way back in the days of OpenInsight 7.2.1 the EditTable was modified so that the speed of setting large amounts of data via the LIST or ARRAY properties was significantly increased.

What was not changed was the speed of getting data via LIST or ARRAY and this can have a impact on the setting speed if you're not careful, because each Set_Property operation performs an implicit Get_Property regardless of whether or not you actually want the original data.

For example, if you already have 10000 lines of data in your EditTable and you want to use the LIST or ARRAY property to set new data you may still see a speed drop as the system uses the slow Get_Property to retrieve the original data before the update.

To overcome this problem you can tell the EditTable to clear the existing data before you use Set_Property, that way the implicit Get_Property has nothing to process. This can be done with SendMessage() and the DTM_RESETDATA message like so:


0001     equ DTM_RESETDATA$ to 1025
0002     
0003     hwndEdt = get_Property( @window : ".TABLE_1", "HANDLE" )
0004     call sendMessage( hwndEdt, DTM_RESETDATA$, 0, 0 )
0005     
0006     call set_Property( @window : ".TABLE_1", "LIST", lotsOfStuff )


No comments:

Post a Comment