Child pages
  • JSFoundSet

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
{div:style=}
Wiki Markup
Div
styledisplay: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.

\\ \\ Enter additional information related to this



Enter additional information related to this 'class'

inside

the

\

{div}

macro

with

'id=description'

{div} {div:id=description}{div}\\ {table:id=|class=servoy sSummary}{colgroup}{column:width=80px|padding=0px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Property Summary{th}{tr}{table}\\ {table:id=|class=servoy sSummary}{colgroup}{column:width=80px|padding=0px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method Summary{th}{tr}{tbody}{tr}{td}[Boolean]{td}{td}[#deleteAllRecords]\() Delete all records in foundset, resulting in empty foundset.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#deleteRecord]\() Delete currently selected record(s).{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#deleteRecord]\(record) Delete record from foundset.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#deleteRecord]\(index) Delete record with the given index.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#find]\() Set the foundset in find mode.{td}{tr}{tbody}{tbody}{tr}{td}[JSRecord]{td}{td}[#getRecord]\(index) Get the record object at the index.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#getSelectedIndex]\() Get the current record index of the foundset.{td}{tr}{tbody}{tbody}{tr}{td}[JSRecord]{td}{td}[#getSelectedRecord]\() Get the selected record.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#getSize]\() Get the number of records in this foundset.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#isInFind]\() Check if this foundset is in find mode.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#loadAllRecords]\() Loads all accessible records from the datasource into the foundset.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#newRecord]\() Create a new record on top of the foundset and change selection to it.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#newRecord]\(index, changeSelection) Create a new record in the foundset.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#search]\() Start the database search and use the results, returns the number of records, make sure you did "find" function first.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#setSelectedIndex]\(index) Set the current record index.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#sort]\(recordComparisonFunction) Sorts the foundset based on the given record comparator function.{td}{tr}{tbody}{table}\\ {table:id=property|class=servoy sDetail}{colgroup}{column:width=100%|padding=0px}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Property Details{th}{tr}{table}\\ {table:id=function|class=servoy sDetail}{colgroup}{column:width=100%|padding=0px}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Method Details{th}{tr}{tbody:id=deleteAllRecords}{tr:id=name}{td}h6.deleteAllRecords{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}deleteAllRecords{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Delete all records in foundset, resulting in empty foundset.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- boolean true if all records could be deleted.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}

Div
iddescription


HTML Table
id
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Property Summary

HTML Table
id
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#deleteAllRecords()
Delete all records in foundset, resulting in empty foundset.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#deleteRecord()
Delete currently selected record(s).
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#deleteRecord(record)
Delete record from foundset.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#deleteRecord(index)
Delete record with the given index.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#find()
Set the foundset in find mode.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSRecord
Table Cell (td)
#getRecord(index)
Get the record object at the index.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#getSelectedIndex()
Get the current record index of the foundset.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSRecord
Table Cell (td)
#getSelectedRecord()
Get the selected record.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#getSize()
Get the number of records in this foundset.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#isInFind()
Check if this foundset is in find mode.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#loadAllRecords()
Loads all accessible records from the datasource into the foundset.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#newRecord()
Create a new record on top of the foundset and change selection to it.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#newRecord(index, changeSelection)
Create a new record in the foundset.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#search()
Start the database search and use the results, returns the number of records, make sure you did "find" function first.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#setSelectedIndex(index)
Set the current record index.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#sort(recordComparisonFunction)
Sorts the foundset based on the given record comparator function.

HTML Table
idproperty
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Property Details

HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Method Details
Table Body (tbody)
iddeleteAllRecords
Table Row (tr)
idname
Table Cell (td)
deleteAllRecords
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
deleteAllRecords
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Delete all records in foundset, resulting in empty foundset.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean – boolean true if all records could be deleted.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var success = forms.customer.foundset.deleteAllRecords();
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=deleteRecord}{tr:id=name}{td}h6.deleteRecord{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}deleteRecord{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Delete currently selected record(s). If the foundset is in multiselect mode, all selected records are deleted.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- boolean true if all records could be deleted.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
iddeleteRecord
Table Row (tr)
idname
Table Cell (td)
deleteRecord
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
deleteRecord
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Delete currently selected record(s).
If the foundset is in multiselect mode, all selected records are deleted.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean – boolean true if all records could be deleted.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var success = forms.customer.foundset.deleteRecord();
//can return false incase of related foundset having records and orphans records are not allowed by the relation
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=deleteRecord-JSRecord}{tr:id=name}{td}h6.deleteRecord{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}deleteRecord{span}{span}\(record){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Delete record from foundset.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[JSRecord]} record -- The record to delete from the foundset. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- boolean true if record could be deleted.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
iddeleteRecord-JSRecord
Table Row (tr)
idname
Table Cell (td)
deleteRecord
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
deleteRecord
Span
(record)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Delete record from foundset.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{JSRecord} record – The record to delete from the foundset.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean – boolean true if record could be deleted.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var success = forms.customer.foundset.deleteRecord(rec);
//can return false incase of related foundset having records and orphans records are not allowed by the relation
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=deleteRecord-Number}{tr:id=name}{td}h6.deleteRecord{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}deleteRecord{span}{span}\(index){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Delete record with the given index.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} index -- The index of the record to delete. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- boolean true if record could be deleted.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
iddeleteRecord-Number
Table Row (tr)
idname
Table Cell (td)
deleteRecord
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
deleteRecord
Span
(index)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Delete record with the given index.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{Number} index – The index of the record to delete.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean – boolean true if record could be deleted.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var success = forms.customer.foundset.deleteRecord(4);
//can return false incase of related foundset having records and orphans records are not allowed by the relation
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=find}{tr:id=name}{td}h6.find{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}find{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Set the foundset in find mode. (Start a find request), use the "search" function to perform/exit the find. Before going into find mode, all unsaved records will be saved in the database. If this fails (due to validation failures or sql errors) or is not allowed (autosave off), the foundset will not go into find mode. Make sure the operator and the data (value) are part of the string passed to dataprovider (included inside a pair of quotation marks). Note: always make sure to check the result of the find() method. When in find mode, columns can be assigned string expressions (including operators) that are evaluated as: General: c1||c2 (condition1 or condition2) c|format (apply format on condition like 'x|dd\-MM\-yyyy') !c (not condition) #c (modify condition, depends on column type) ^ (is null) ^= (is null or empty) <x (less than value x) >x (greater than value x) <=x (less than or equals value x) >=x (greater than or equals value x) x...y (between values x and y, including values) x (equals value x) Number fields: =x (equals value x) ^= (is null or zero) Date fields: #c (equals value x, entire day) now (equals now, date and or time) // (equals today) today (equals today) Text fields: #c (case insensitive condition) = x (equals a space and 'x') ^= (is null or empty) %x% (contains 'x') %x\_y% (contains 'x' followed by any char and 'y') \% (contains char '%') \_ (contains char '\_') Related columns can be assigned, they will result in related searches. For example, "employees\_to\_department.location\_id = headoffice" finds all employees in the specified location). Searching on related aggregates is supported. For example, "orders\_to\_details.total\_amount = '>1000'" finds all orders with total order details amount more than 1000. Arrays can be used for searching a number of values, this will result in an 'IN' condition that will be used in the search. The values are not restricted to strings but can be any type that matches the column type. For example, "record.department\_id = \[1, 33, 99\]"{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if the foundset is now in find mode, false otherwise.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idfind
Table Row (tr)
idname
Table Cell (td)
find
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
find
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent

Set the foundset in find mode. (Start a find request), use the "search" function to perform/exit the find.

Before going into find mode, all unsaved records will be saved in the database.
If this fails (due to validation failures or sql errors) or is not allowed (autosave off), the foundset will not go into find mode.
Make sure the operator and the data (value) are part of the string passed to dataprovider (included inside a pair of quotation marks).
Note: always make sure to check the result of the find() method.

When in find mode, columns can be assigned string expressions (including operators) that are evaluated as:
General:
c1||c2 (condition1 or condition2)
c|format (apply format on condition like 'x|dd-MM-yyyy')
!c (not condition)
#c (modify condition, depends on column type)
^ (is null)
^= (is null or empty)
<x (less than value x)
>x (greater than value x)
<=x (less than or equals value x)
>=x (greater than or equals value x)
x...y (between values x and y, including values)
x (equals value x)

Number fields:
=x (equals value x)
^= (is null or zero)

Date fields:
#c (equals value x, entire day)
now (equals now, date and or time)
// (equals today)
today (equals today)

Text fields:
#c (case insensitive condition)
= x (equals a space and 'x')
^= (is null or empty)
%x% (contains 'x')
%x_y% (contains 'x' followed by any char and 'y')
% (contains char '%')
\_ (contains char '_')

Related columns can be assigned, they will result in related searches.
For example, "employees_to_department.location_id = headoffice" finds all employees in the specified location).

Searching on related aggregates is supported.
For example, "orders_to_details.total_amount = '>1000'" finds all orders with total order details amount more than 1000.

Arrays can be used for searching a number of values, this will result in an 'IN' condition that will be used in the search.
The values are not restricted to strings but can be any type that matches the column type.
For example, "record.department_id = [1, 33, 99]"

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean – true if the foundset is now in find mode, false otherwise.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

if (forms.customer.foundset.find()) //find will fail if autosave is disabled and there are unsaved records
{
	columnTextDataProvider = 'a search value'
	// for numbers you have to make sure to format it correctly so that the decimal point is in your locales notation (. or ,)
	columnNumberDataProvider = '>' + utils.numberFormat(anumber, '####.00');
	columnDateDataProvider = '31-12-2010|dd-MM-yyyy'
	forms.customer.foundset.search()
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getRecord-Number}{tr:id=name}{td}h6.getRecord{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[JSRecord]{span}{span:style=font-weight: bold;}getRecord{span}{span}\(index){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the record object at the index.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} index -- record index {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[JSRecord] -- Record record.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetRecord-Number
Table Row (tr)
idname
Table Cell (td)
getRecord
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSRecord
Span
stylefont-weight: bold;
getRecord
Span
(index)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Get the record object at the index.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{Number} index – record index
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
JSRecord – Record record.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var record = forms.customer.foundset.getRecord(index)
; {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getSelectedIndex}{tr:id=name}{td}h6.getSelectedIndex{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}getSelectedIndex{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the current record index of the foundset.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- int current index (1-based){div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
;
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetSelectedIndex
Table Row (tr)
idname
Table Cell (td)
getSelectedIndex
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
getSelectedIndex
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Get the current record index of the foundset.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number – int current index (1-based)
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

//gets the current record index in the current foundset
var current = forms.customer.foundset.getSelectedIndex();
//sets the next record in the foundset
forms.customer.foundset.setSelectedIndex(current+1);
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getSelectedRecord}{tr:id=name}{td}h6.getSelectedRecord{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[JSRecord]{span}{span:style=font-weight: bold;}getSelectedRecord{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the selected record.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[JSRecord] -- Record record.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetSelectedRecord
Table Row (tr)
idname
Table Cell (td)
getSelectedRecord
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSRecord
Span
stylefont-weight: bold;
getSelectedRecord
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Get the selected record.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
JSRecord – Record record.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var selectedRecord = forms.customer.foundset.getSelectedRecord();
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getSize}{tr:id=name}{td}h6.getSize{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}getSize{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the number of records in this foundset. This is the number of records loaded, note that when looping over a foundset, size() may increase as more records are loaded.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- int current size.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetSize
Table Row (tr)
idname
Table Cell (td)
getSize
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
getSize
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Get the number of records in this foundset.
This is the number of records loaded, note that when looping over a foundset, size() may
increase as more records are loaded.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number – int current size.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var nrRecords = forms.customer.foundset.getSize()

// to loop over foundset, recalculate size for each record
for (var i = 1; i <= forms.customer.foundset.getSize(); i++)
{
	var rec = forms.customer.foundset.getRecord(i);
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=isInFind}{tr:id=name}{td}h6.isInFind{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}isInFind{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Check if this foundset is in find mode.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- boolean is in find mode.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idisInFind
Table Row (tr)
idname
Table Cell (td)
isInFind
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
isInFind
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Check if this foundset is in find mode.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean – boolean is in find mode.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

//Returns true when find was called on this foundset and search has not been called yet
forms.customer.foundset.isInFind();
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=loadAllRecords}{tr:id=name}{td}h6.loadAllRecords{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}loadAllRecords{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Loads all accessible records from the datasource into the foundset. Filters on the foundset are applied. Before loading the records, all unsaved records will be saved in the database. If this fails (due to validation failures or sql errors) or is not allowed (autosave off), records will not be loaded,{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if records are loaded, false otherwise.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idloadAllRecords
Table Row (tr)
idname
Table Cell (td)
loadAllRecords
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
loadAllRecords
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent

Loads all accessible records from the datasource into the foundset.
Filters on the foundset are applied.

Before loading the records, all unsaved records will be saved in the database.
If this fails (due to validation failures or sql errors) or is not allowed (autosave off),
records will not be loaded,

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean – true if records are loaded, false otherwise.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

forms.customer.foundset.loadAllRecords();
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=newRecord}{tr:id=name}{td}h6.newRecord{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}newRecord{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Create a new record on top of the foundset and change selection to it. Returns \-1 if the record can't be made.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- int index of new record.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idnewRecord
Table Row (tr)
idname
Table Cell (td)
newRecord
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
newRecord
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Create a new record on top of the foundset and change selection to it. Returns -1 if the record can't be made.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number – int index of new record.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

// foreign key data is only filled in for equals (=) relation items 
var idx = forms.customer.foundset.newRecord(false); // add as last record
// forms.customer.foundset.newRecord(); // adds as first record
// forms.customer.foundset.newRecord(2); //adds as second record
if (idx >= 0) // returned index is -1 in case of failure 
{
	forms.customer.foundset.some_column = "some text";
	application.output("added on position " + idx);
	// when adding at the end of the foundset, the returned index
	// corresponds with the size of the foundset
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idnewRecord-Number_Boolean
}{
Table Row (tr)
:
id
=
name
}{td}h6.newRecord{td}{tr}{tr:id=sig}{td}{span:style=
Table Cell (td)
newRecord
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right:
5px;
}[
Number
]{span}{span:style=
Span
stylefont-weight:
bold;
}newRecord{span}{span}\
newRecord
Span
(index,
changeSelection)
{span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Create a new record in the foundset. Returns \-1 if the record can't be made.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} index -- the new record is added at specified index. \{[Boolean]} changeSelection -- when true the selection is changed to the new record. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- int index of new record.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Create a new record in the foundset. Returns -1 if the record can't be made.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{Number} index – the new record is added at specified index.
{Boolean} changeSelection – when true the selection is changed to the new record.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number – int index of new record.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

// foreign key data is only filled in for equals (=) relation items 
var idx = forms.customer.foundset.newRecord(false); // add as last record
// forms.customer.foundset.newRecord(); // adds as first record
// forms.customer.foundset.newRecord(2); //adds as second record
if (idx >= 0) // returned index is -1 in case of failure 
{
	forms.customer.foundset.some_column = "some text";
	application.output("added on position " + idx);
	// when adding at the end of the foundset, the returned index
	// corresponds with the size of the foundset
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=search}{tr:id=name}{td}h6.search{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}search{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Start the database search and use the results, returns the number of records, make sure you did "find" function first. Clear results from previous searches. Note: Omitted records are automatically excluded when performing a search \- meaning that the foundset result by default will not include omitted records.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- the recordCount{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsearch
Table Row (tr)
idname
Table Cell (td)
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
search
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent

Start the database search and use the results, returns the number of records, make sure you did "find" function first.
Clear results from previous searches.

Note: Omitted records are automatically excluded when performing a search - meaning that the foundset result by default will not include omitted records.

Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number – the recordCount
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var recordCount = forms.customer.foundset.search();
//var recordCount = forms.customer.foundset.search(false,false); //to extend foundset
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=setSelectedIndex-Number}{tr:id=name}{td}h6.setSelectedIndex{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}setSelectedIndex{span}{span}\(index){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Set the current record index.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} index -- index to set (1\-based) {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsetSelectedIndex-Number
Table Row (tr)
idname
Table Cell (td)
setSelectedIndex
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
setSelectedIndex
Span
(index)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Set the current record index.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{Number} index – index to set (1-based)
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

//gets the current record index in the current foundset
var current = forms.customer.foundset.getSelectedIndex();
//sets the next record in the foundset
forms.customer.foundset.setSelectedIndex(current+1);
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=sort-Function}{tr:id=name}{td}h6.sort{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}sort{span}{span}\(recordComparisonFunction){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Sorts the foundset based on the given record comparator function. The comparator function is called to compare two records, that are passed as arguments, and it will return \
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsort-Function
Table Row (tr)
idname
Table Cell (td)
sort
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
sort
Span
(recordComparisonFunction)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent

Sorts the foundset based on the given record comparator function.
The comparator function is called to compare
two records, that are passed as arguments, and
it will return -1/0/1

if

the

first

record

is

less/equal/greater


then

the

second

record.

The

function

based

sorting

does

not

work

with

printing.


It

is

just

a

temporary

in

\

-memory

sort.

NOTE:

starting

with

7.2

release

this

function

doesn't

save

the

data

anymore{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Function]} recordComparisonFunction -- record comparator function {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}

anymore

Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{Function} recordComparisonFunction – record comparator function
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

forms.customer.foundset.sort(mySortFunction);

function mySortFunction(r1, r2)
{
	var o = 0;
	if(r1.id < r2.id)
	{
		o = -1;
	}
	else if(r1.id > r2.id)
	{
		o = 1;
	}
	return o;
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}
Table Row (tr)
classlastDetailRow
Table Cell (td)