Class

# DBKit.Row

<div class="rst-class">

forsearch

</div>

DBKit.Row

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Represents a single row of data from a database table in DBKit.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                         | Type                               | Read-Only | Shared |
|----------------------------------------------|------------------------------------|-----------|--------|
| `Column<dbkit.row.column>`                   | `Variant</api/data_types/variant>` |           |        |
| `IsBeingEdited<dbkit.row.isbeingedited>`     | `Boolean</api/data_types/boolean>` |           |        |
| `IsNew<dbkit.row.isnew>`                     | `Boolean</api/data_types/boolean>` |           |        |
| `PrimaryKeyValue<dbkit.row.primarykeyvalue>` | `String</api/data_types/string>`   |           |        |
| `Tag<dbkit.row.tag>`                         | `Variant</api/data_types/variant>` |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                     | Parameters                                                                                                                                                                                                            | Returns                               | Shared |
|----------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------|--------|
| `Constructor<dbkit.row.constructor>`                     | theLayout As `DBKit.SDK.Layout`, relatedTableName As `String</api/data_types/string>` = "", newRow As `Boolean</api/data_types/boolean>` = `False</api/data_types/boolean>`                                           |                                       |        |
| `Constructor<dbkit.row.constructor>`                     | theLayout As `DBKit.SDK.Layout`, table As `String</api/data_types/string>` = "", newRow As `Boolean</api/data_types/boolean>` = `False</api/data_types/boolean>`, theRow As `DatabaseRow</api/databases/databaserow>` |                                       |        |
| `HasChanged<dbkit.row.haschanged>`                       |                                                                                                                                                                                                                       | `Boolean</api/data_types/boolean>`    |        |
| `HasColumn<dbkit.row.hascolumn>`                         | columnName As `String</api/data_types/string>`                                                                                                                                                                        | `Boolean</api/data_types/boolean>`    |        |
| `HasValue<dbkit.row.hasvalue>`                           | columnName As `String</api/data_types/string>`                                                                                                                                                                        | `Boolean</api/data_types/boolean>`    |        |
| `LoadRelatedParentRows<dbkit.row.loadrelatedparentrows>` |                                                                                                                                                                                                                       |                                       |        |
| `ParentRow<dbkit.row.parentrow>`                         | targetParentTableName As `String</api/data_types/string>`, viaColumnName As `String</api/data_types/string>` = ""                                                                                                     | `DBKit.Row</api/databases/dbkit/row>` |        |
| `Removed<dbkit.row.removed>`                             | deleteRelatedRows As `Boolean</api/data_types/boolean>` = `False</api/data_types/boolean>`                                                                                                                            | `Boolean</api/data_types/boolean>`    |        |
| `Saved<dbkit.row.saved>`                                 |                                                                                                                                                                                                                       | `Boolean</api/data_types/boolean>`    |        |
| `TableName<dbkit.row.tablename>`                         |                                                                                                                                                                                                                       | `String</api/data_types/string>`      |        |
| `Undo<dbkit.row.undo>`                                   |                                                                                                                                                                                                                       |                                       |        |

## Property descriptions

<div id="dbkit.row.column">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.Row.Column

**Column**(name As `String</api/data_types/string>`) As `Variant</api/data_types/variant>`

> The value of the column *name* in this row.

<div id="dbkit.row.isbeingedited">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.Row.IsBeingEdited

**IsBeingEdited** As `Boolean</api/data_types/boolean>`

> Whether the user is currently editing this row. Setting it to True informs the row's controls that editing has begun.

<div id="dbkit.row.isnew">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.Row.IsNew

**IsNew** As `Boolean</api/data_types/boolean>`

> Whether this row is new and has not yet been saved to the database.

<div id="dbkit.row.primarykeyvalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.Row.PrimaryKeyValue

**PrimaryKeyValue** As `String</api/data_types/string>`

> The value of the row's primary key column.

<div id="dbkit.row.tag">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.Row.Tag

**Tag** As `Variant</api/data_types/variant>`

> A value you can associate with this row.

## Method descriptions

<div id="dbkit.row.constructor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.Row.Constructor

**Constructor**(theLayout As `DBKit.SDK.Layout`, relatedTableName As `String</api/data_types/string>` = "", newRow As `Boolean</api/data_types/boolean>` = `False</api/data_types/boolean>`)

> Called when the row is created. Creates a new row from scratch for the table *relatedTableName*, or the layout's table if *relatedTableName* is empty. *theLayout* is the layout the row belongs to: a `DBKit.Window</api/databases/dbkit/window>`, `DBKit.Page</api/databases/dbkit/page>` or `DBKit.Container</api/databases/dbkit/container>`, all of which are `DBKit.SDK.Layouts`. Pass True for *newRow* to mark the row as new.

**Constructor**(theLayout As `DBKit.SDK.Layout`, table As `String</api/data_types/string>` = "", newRow As `Boolean</api/data_types/boolean>` = `False</api/data_types/boolean>`, theRow As `DatabaseRow</api/databases/databaserow>`)

> Called when the row is created. Creates a row from the `DatabaseRow</api/databases/databaserow>` *theRow* for the table *table*, or the layout's table if *table* is empty. *theLayout* is the layout the row belongs to: a `DBKit.Window</api/databases/dbkit/window>`, `DBKit.Page</api/databases/dbkit/page>` or `DBKit.Container</api/databases/dbkit/container>`, all of which are `DBKit.SDK.Layouts`.

<div id="dbkit.row.haschanged">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.Row.HasChanged

**HasChanged**() As `Boolean</api/data_types/boolean>`

> Whether any column value in this row differs from the original row, meaning the row has unsaved changes.

<div id="dbkit.row.hascolumn">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.Row.HasColumn

**HasColumn**(columnName As `String</api/data_types/string>`) As `Boolean</api/data_types/boolean>`

> Whether this row has a column named *columnName*.

<div id="dbkit.row.hasvalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.Row.HasValue

**HasValue**(columnName As `String</api/data_types/string>`) As `Boolean</api/data_types/boolean>`

> Whether this row has a value for the column *columnName*.

<div id="dbkit.row.loadrelatedparentrows">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.Row.LoadRelatedParentRows

**LoadRelatedParentRows**()

> Loads the parent rows of the other tables on the layout that are related to this row.

<div id="dbkit.row.parentrow">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.Row.ParentRow

**ParentRow**(targetParentTableName As `String</api/data_types/string>`, viaColumnName As `String</api/data_types/string>` = "") As `DBKit.Row</api/databases/dbkit/row>`

> Returns the parent row from the table *targetParentTableName* that is related to this row, optionally reached via the column *viaColumnName*.

<div id="dbkit.row.removed">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.Row.Removed

**Removed**(deleteRelatedRows As `Boolean</api/data_types/boolean>` = `False</api/data_types/boolean>`) As `Boolean</api/data_types/boolean>`

> Deletes this row from the database. If *deleteRelatedRows* is True, rows related to this row are also deleted, working down the one-to-many chain. Returns True if the row was deleted.

<div id="dbkit.row.saved">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.Row.Saved

**Saved**() As `Boolean</api/data_types/boolean>`

> Saves this row to the database, adding it if it is new or updating it if it is not. Returns True if the row was saved.

<div id="dbkit.row.tablename">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.Row.TableName

**TableName**() As `String</api/data_types/string>`

> Returns the name of the database table this row belongs to.

<div id="dbkit.row.undo">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.Row.Undo

**Undo**()

> Discards the changes made to this row, restoring its original values from the database.

## Notes

### Changing a column value in code

Setting a column value in code, for example `CurrentRow.Column("LastName") = "Smith"`, updates any control bound to that column. This only happens while the row is being edited; setting a column value outside of edit mode does not refresh the bound controls.

### Return value of Saved

`Saved<dbkit.row.saved>` returns True if the row was saved to the database or if the row had no changes to save. It returns False if the save failed, for example because of a database error.

When a new row is added, columns with null values are not written to the database.

### Undo restores database values

`Undo<dbkit.row.undo>` reverts any changes made to this row before `Saved<dbkit.row.saved>` was called, restoring its original values from the database.

### Changing a child key loads the parent row

When the value of a child key column is changed, the new parent row is loaded automatically and a Loaded event is sent for the new parent table.

## Compatibility

|                       |         |
|-----------------------|---------|
| **Project Types**     | Desktop |
| **Operating Systems** | All     |

<div id="dbkit.row.seealso">

<div class="seealso">

`Object</api/data_types/additional_types/object>` parent class.

</div>

</div>
