Omnis Technical Note TNNO0011

Creating default values in new rows in an extendable data grid

For Omnis Studio
By Omnis Technical Support

How do I enter default values in new rows in an extendable data grid?

Summary

Please find an example attached that demonstrates exactly how this is achieved. Simply tab through the fields and each new line will be filled with new default values. This demonstrates use of the event parameter, 'pRow', which is passed to the list event 'evExtend'. One can use pRow to assign values to the new line. To assign all the values at once one could use: pRow.$assigncols(Val1,Val2,Val3,....). The method behind the grid field uses the evExtend event as follows:

On evExtend
    Do pRow.cc_Text.$assign(con('Next Row ',pRow.$line))
    Do pRow.cl_List.$assign(cl_List)


Download a library from GitHub: https://github.com/OmnisStudio/Omnis-ExtendGrid (for Studio 8.1.2 or above)
(or an archive: Grid.zip for Studio 4 or above, may require conversion)