Child pages
  • JSRecord

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Divcache
Div
iddescription
HTML Table
id
classservoy sSummary
Colgroup Tag
Col
width80px
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Property Summary
Table Row (tr)
Table Cell (td)
ServoyException
Table Cell (td)exception
styleindexdisplay:none

DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.

true
refresh100d
showRefreshtrue
iddoc
titleRefresh page
showDatetrue
retryEnable

servoy sReturnTypes2100%height: 30px;2Supported ClientssWordListSmartClientsWordListWebClientsWordListNGClientsWordListMobileClient

servoy sSummary12%30%58%height: 30px;3Property SummaryReturns last occurred exception on this record (or null). Table Row (tr)

Table Cell (td)
JSFoundSet
Table Cell (td)foundset
Returns parent foundset of the record. HTML Tableidclassservoy sSummaryid
Colgroup Tag
Col
width80px
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Row (tr)
Table Cell (td)
JSDataSet
Table Cell (td)getChangedData()
Returns the validation object if there where validation failures for this record Can be set to null again if you checked the problems, will also be set to null when a save was successful.

Table Cell (td)getDataSource()
servoy sSummary12%30%58%height: 30px;3Methods SummaryCreates and returns a new validation object for this record, which allows for markers to be used outside the validation flow.Returns a JSDataSet with outstanding (not saved) changed data of this record. Table Row (tr)

Table Cell (td)
String
Returns the records datasource string. Table Row (tr)
Table Cell (td)
Object[]
Table Cell (td)getPKs()
Returns an array with the primary key values of the record. Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)hasChangedData()
Returns true if the current record has outstanding/changed data. Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)isEditing()
Returns true or false if the record is being edited or not. Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)isNew()
Returns true if the current record is a new record or false otherwise. Table Row (tr)
Table Cell (td)
void
Table Cell (td)revertChanges()
.Returns true or false if the related foundset is already loaded.voidReverts the in memory outstanding (not saved) changes of the record.

HTML Table

propertyclass Colgroup Tag Colcolspanservoy sDetail2width100%

Col
Table Head (thead) Table Row (tr)styleheight:30px; Table Head (th)colspan2Property Details Table Body (tbody)ididexception Table Row (tr)nametd

exception

tr

iddes Table Cell (td) DivclassidsIndent
Returns last occurred exception on this record (or null).
Table Row (tr)ret

Table Cell (td)

Returns

div

classsIndentServoyException - id The occurred exception.clients

Table Row (tr)

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Table Cell (td)

Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idfoundset
Table Row (tr)
idname
Table Cell (td)

foundset

Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns parent foundset of the record.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
JSFoundSet -

Sample

Div
classsIndent
Code Block
languagejavascript
var exception = record.exception;
tdsIdentjavascriptlastDetailRowfoundsetname

foundset

dessIndent
Returns parent foundset of the record.
ret

Returns

sIndent The parent foundset of the record.
clients

Table Row (tr)

idsam
Colgroup Tag
Col
colspan2
width100%
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Details
Table Body (tbody)
idgetChangedData
Table Row (tr)
idname
Table Cell (td)

getChangedData

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSDataSet
Span
stylefont-weight: bold;
getChangedData
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent

Returns a JSDataSet with outstanding (not saved) changed data of this record.
column1 is the column name, colum2 is the old data and column3 is the new data.

NOTE: To return an array of records with outstanding changed data, see the function databaseManager.getEditedRecords().

Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
JSDataSet -

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

Div
classsIndent
Code Block
languagejavascript
var parent = record.foundset;
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
HTML Table
idfunction
classservoy sDetail
sIdentjavascriptlastDetailRowrecordMarkersname

recordMarkers

dessIndent
Returns the validation object if there where validation failures for this record
Can be set to null again if you checked the problems, will also be set to null when a save was successful.
ret

Returns

sIndent The last validation object if the record was not validated.
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow

idfunctionservoy sDetail2100%height:30px2Methods DetailscreateMarkersname

createMarkers()

dessIndent
Creates and returns a new validation object for this record, which allows for markers to be used outside the validation flow.
Will overwrite the current markers if present.
Can be set to null again if you checked the problems, will also be set to null when a save was successful.
ret

Returns

sIndent A new validation object.
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getChangedDataname

getChangedData()

dessIndent
Returns a JSDataSet with outstanding (not saved) changed data of this record.
column1 is the column name, colum2 is the old data and column3 is the new data.

NOTE: To return an array of records with outstanding changed data, see the function databaseManager.getEditedRecords().
ret

Returns

sIndent a JSDataSet with the changed data of this record.
clients

Table Row (tr)

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Table Cell (td)

Table Row (tr)
idname
Table Cell (td)

getDataSource

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getDataSource
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the records datasource string.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
String -

Sample

Div
classsIndent
Code Block
languagejavascript
/** @type {JSDataSet} */
var dataset = record.getChangedData()
for( var i = 1 ; i <= dataset.getMaxRowIndex() ; i++ )
{
	application.output(dataset.getValue(i,1) +' '+ dataset.getValue(i,2) +' '+ dataset.getValue(i,3));
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetDataSource
idsIdentjavascriptlastDetailRowgetDataSourcename

getDataSource()

dessIndent
Returns the records datasource string.
ret

Returns

sIndent The datasource string of this record.
clients

Table Row (tr)

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Table Cell (td) Table Row (tr)

idret
Table Cell (td)

Returns

Div
classsIndent
Object[] -

Sample

Div
classsIndent
Code Block
languagejavascript
var ds = record.getDataSource();
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetPKs
Table Row (tr)
idname
Table Cell (td)

getPKs

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Object[]
Span
stylefont-weight: bold;
getPKs
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns an array with the primary key values of the record.
idsIdentjavascriptlastDetailRowgetPKsname

getPKs()

dessIndent
Returns an array with the primary key values of the record.
ret

Returns

sIndent an Array with the pk values.
clients

Table Row (tr)

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Table Cell (td) Table Cell (td)

Returns

Div
classsIndent
Boolean -

Sample

Div
classsIndent
Code Block
languagejavascript
var pks = foundset.getSelectedRecord().getPKs() // also foundset.getRecord can be used
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idhasChangedData
Table Row (tr)
idname
Table Cell (td)

hasChangedData

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
hasChangedData
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if the current record has outstanding/changed data.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Boolean - sIdentjavascriptlastDetailRowhasChangedDataname

hasChangedData()

dessIndent
Returns true if the current record has outstanding/changed data.
ret

Returns

sIndent true if the current record has outstanding/changed data.
clients

Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var hasChanged = record.hasChangedData();
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idisEditing
Table Row (tr)
idname
Table Cell (td)

isEditing

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
isEditing
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true or false if the record is being edited or not.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Boolean - a boolean when in edit.
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var isEditing = foundset.getSelectedRecord().isEditing() // also foundset.getRecord can be used
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idisNew
Table Row (tr)
idname
Table Cell (td)

isNew

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
isNew
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if the current record is a new record or false otherwise.
Table Row (tr)
idret
td

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
isEditingname

isEditing()

dessIndent
Returns true or false if the record is being edited or not.

This will not check if the record doesn't really have any changes, it just returns the edit state.
So this can return true but databaseManager.getEditedRecord() will not return this record because that
call will check if the record has really any changed values compared to the stored database values.
Record can be in edit mode without changes when some field is focused (so edit is started) but no changes are done yet
or when changes were done in such a way that record data is the same as database data.
ret

Returns

sIndent a boolean when in edit.
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow
isNewname

isNew()

dessIndent
Returns true if the current record is a new record or false otherwise. New record means not saved to database.
ret

Returns

sIndent true if the current record is a new record, false otherwise;
clients

Table Row (tr)

idsam
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idrevertChanges
Table Row (tr)
idname
Table Cell (td)

revertChanges

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
revertChanges
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Reverts the in memory outstanding (not saved) changes of the record.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var record= forms.customer.foundset.getSelectedRecord();
record.revertChanges();
Table Row (tr)
classlastDetailRow
Table Cell (td) 

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

Div
classsIndent
Code Block
languagejavascript
var isNew = foundset.getSelectedRecord().isNew();
sIdentjavascriptlastDetailRowisRelatedFoundSetLoadedname

isRelatedFoundSetLoaded(relationName)

dessIndent
Returns true or false if the related foundset is already loaded. Will not load the related foundset.
prs

Parameters

sIndentrelationNamename of the relation to check for
ret

Returns

sIndent a boolean when loaded.
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
revertChangesname

revertChanges()

dessIndent
Reverts the in memory outstanding (not saved) changes of the record.
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow