# JSBaseSqlRecord

## Overview

`JSBaseSQLRecord` serves as the foundational type for records in SQL-based foundsets, such as those in `JSFoundSet` or `ViewFoundSet`. It extends `JSBaseRecord`, inheriting its base functionality while introducing features tailored to SQL data handling. The `exception` property handles errors at the record level, while `foundset` links the record to its originating dataset. Additionally, `recordMarkers` facilitates the attachment of metadata or annotations directly to records.

Key methods include `createMarkers`, which generates detailed annotations for a record, and `getChangedData`, which retrieves altered data within a record. The `getPKs` method identifies associated primary keys, while `hasChangedData` confirms if modifications exist. Editing states are managed through `isEditing`, which checks if a record is in edit mode, and `isNew`, which identifies newly created records. Relationship management is supported by `isRelatedFoundSetLoaded`, ensuring related datasets are loaded. The `revertChanges` method enables rolling back unsaved modifications.

## **Extends**

[JSBaseRecord](/reference/servoycore/dev-api/database-manager/jsbaserecord.md)

## Properties Summarized

| Type                                                                                                 | Name                            | Summary |
| ---------------------------------------------------------------------------------------------------- | ------------------------------- | ------- |
| [Exception](https://github.com/Servoy/gitbook/blob/master/reference/servoycore/dev-api/exception.md) | [exception](#exception)         |         |
| [JSFoundSet](/reference/servoycore/dev-api/database-manager/jsfoundset.md)                           | [foundset](#foundset)           |         |
| [JSRecordMarkers](/reference/servoycore/dev-api/database-manager/jsrecordmarkers.md)                 | [recordMarkers](#recordmarkers) |         |

## Methods Summarized

| Type                                                                                 | Name                                                                           | Summary |
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------- |
| [JSRecordMarkers](/reference/servoycore/dev-api/database-manager/jsrecordmarkers.md) | [createMarkers()](#createmarkers)                                              |         |
| [JSDataSet](/reference/servoycore/dev-api/database-manager/jsdataset.md)             | [getChangedData()](#getchangeddata)                                            |         |
| [String](/reference/servoycore/dev-api/js-lib/string.md)                             | [getDataSource()](#getdatasource)                                              |         |
| [Array](/reference/servoycore/dev-api/js-lib/array.md)                               | [getPKs()](#getpks)                                                            |         |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)                           | [hasChangedData()](#haschangeddata)                                            |         |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)                           | [isEditing()](#isediting)                                                      |         |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)                           | [isNew()](#isnew)                                                              |         |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)                           | [isRelatedFoundSetLoaded(relationName)](#isrelatedfoundsetloaded-relationname) |         |
| void                                                                                 | [revertChanges()](#revertchanges)                                              |         |

## Properties Detailed

### exception

**Type**\
[Exception](https://github.com/Servoy/gitbook/blob/master/reference/servoycore/dev-api/exception.md) the exception associated with this record, or null if no exception exists.

### foundset

**Type**\
[JSFoundSet](/reference/servoycore/dev-api/database-manager/jsfoundset.md) the foundset to which this record belongs.

### recordMarkers

**Type**\
[JSRecordMarkers](/reference/servoycore/dev-api/database-manager/jsrecordmarkers.md) the record markers associated with this record.

## Methods Detailed

### createMarkers()

**Returns:** [JSRecordMarkers](/reference/servoycore/dev-api/database-manager/jsrecordmarkers.md) newly created record markers for this record.

### getChangedData()

**Returns:** [JSDataSet](/reference/servoycore/dev-api/database-manager/jsdataset.md) a dataset containing the changed data for this record.

### getDataSource()

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) the data source associated with this record.

### getPKs()

**Returns:** [Array](/reference/servoycore/dev-api/js-lib/array.md) an array of primary key values associated with this record.

### hasChangedData()

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) true if the record has modified data; false otherwise.

### isEditing()

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) true if the record is in edit mode; false otherwise.

### isNew()

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) true if the record is newly created and not yet saved; false otherwise.

### isRelatedFoundSetLoaded(relationName)

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **relationName** ;

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) true if the related foundset for the given relation name is loaded; false otherwise.

### revertChanges()

**Returns:** void

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.servoy.com/reference/servoycore/dev-api/database-manager/jsbasesqlrecord.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
