programming.nbk: Home | Index | Next Page: Tcl Mk4Tcl: Changing Views | Previous Page: Tcl Mk4Tcl mk::view layout


 Tcl Mk4Tcl: Adding Rows

Adding Rows

Remember that each view holds an array of rows, indexed by position (zero being the first, one being the second, etc.). Initially, a view will have no rows stored in it. The obvious thing then to do is add a new record, which can be done via the "mk::row append" command, as follows:

    set row [mk::row append db.employees]

This will add a new row at the end of any existing rows. Initially, all the properties for this row will be set to empty strings. The command will return a string that you can use to refer to the individual row. For the first row created, this will be "db.employees!0", for the second "db.employees!1", and so on. You can also set one or more properties for the new row by passing the name and values of the properties to the "mk::row append" command:

    mk::row append db.employees name "Mark" employeeid 1 salary 10
    mk::file commit db

The command "mk::view size viewname" command will tell you how many rows are in the specified view.

Next: Tcl Mk4Tcl: Setting Properties


programming.nbk: Home | Index | Next Page: Tcl Mk4Tcl: Changing Views | Previous Page: Tcl Mk4Tcl mk::view layout


Notebook exported on Monday, 7 July 2008, 18:56:06 PM Eastern Daylight Time