{div:style=display: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{div} {div:id=description}A JSFoundset is a scriptable object, it contains record objects defined by its SQL. It does lazy load the PKs and records. Each foundset has its own record set and selected index{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}{tbody}{tr}{td}[String]\[]{td}{td}[#alldataproviders] Get all dataproviders of the foundset.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#multiSelect] Get or set the multiSelect flag of the foundset.{td}{tr}{tbody}{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}[#addFoundSetFilterParam]\(dataprovider, operator, value) Add a filter parameter that is permanent per user session to limit a specified foundset of records.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#addFoundSetFilterParam]\(dataprovider, operator, value, name) Add a filter parameter that is permanent per user session to limit a specified foundset of records.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#clear]\() Clear the foundset.{td}{tr}{tbody}{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}[JSFoundSet]{td}{td}[#duplicateFoundSet]\() Get a duplicate of the foundset.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#duplicateRecord]\() Duplicate current record, change selection to new record, place on top.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#duplicateRecord]\(onTop) Duplicate selected record, change selection to new record.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#duplicateRecord]\(onTop, changeSelection) Duplicate selected record.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#duplicateRecord]\(index) Duplicate record at index in the foundset, change selection to new record, place on top.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#duplicateRecord]\(index, onTop) Duplicate record at index in the foundset, change selection to new record.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#duplicateRecord]\(index, onTop, changeSelection) Duplicate record at index in the foundset.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#duplicateRecord]\(index, location) Duplicate record at index in the foundset, change selection to new record.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#duplicateRecord]\(index, location, changeSelection) Duplicate record at index in the foundset.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#find]\() Set the foundset in find mode.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getCurrentSort]\() Get the current sort columns.{td}{tr}{tbody}{tbody}{tr}{td}[Object]{td}{td}[#getDataProviderValue]\(dataProviderID) Get a value based on a dataprovider name.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getDataSource]\() Get the datasource used.{td}{tr}{tbody}{tbody}{tr}{td}[Object]\[]\[]{td}{td}[#getFoundSetFilterParams]\() Get the list of previously defined foundset filters.{td}{tr}{tbody}{tbody}{tr}{td}[Object]\[]\[]{td}{td}[#getFoundSetFilterParams]\(filterName) Get a previously defined foundset filter, using its given name.{td}{tr}{tbody}{tbody}{tr}{td}[QBSelect]{td}{td}[#getQuery]\() Get the query that the foundset is currently using.{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}[#getRecordIndex]\(record) Get the record index.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getRelationName]\() Gets the relation name (null if not a related foundset).{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#getSelectedIndex]\() Get the current record index of the foundset.{td}{tr}{tbody}{tbody}{tr}{td}[Number]\[]{td}{td}[#getSelectedIndexes]\() Get the indexes of the selected records.{td}{tr}{tbody}{tbody}{tr}{td}[JSRecord]{td}{td}[#getSelectedRecord]\() Get the selected record.{td}{tr}{tbody}{tbody}{tr}{td}[JSRecord]\[]{td}{td}[#getSelectedRecords]\() Get the selected records.{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}[#hasConditions]\() Check wether the foundset has any conditions from a previous find action.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#invertRecords]\() Invert the foundset against all rows of the current table.{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}[Boolean]{td}{td}[#loadOmittedRecords]\() Loads the records that are currently omitted as a foundset.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#loadRecords]\() Reloads all last (related) records again, if, for example, after search in tabpanel.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#loadRecords]\(foundset) Copies foundset data from another foundset.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#loadRecords]\(dataset) Loads a primary key dataset, will remove related sort.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#loadRecords]\(querybuilder) Loads records into form foundset based on a query builder object (also known as 'Form by query').{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#loadRecords]\(uuidpk) Loads a single record by primary key, will remove related sort.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#loadRecords]\(numberpk) Loads a single record by primary key, will remove related sort.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#loadRecords]\(queryString) Loads records into form foundset based on a query (also known as 'Form by query').{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#loadRecords]\(queryString, argumentsArray) Loads records into form foundset based on a query (also known as 'Form by query').{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]\(onTop) Create a new record in the foundset and change selection to it.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#newRecord]\(onTop, changeSelection) Create a new record in the foundset.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#newRecord]\(index) Create a new record in 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}[Boolean]{td}{td}[#omitRecord]\() Omit current record, to be shown with loadOmittedRecords.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#omitRecord]\(index) Omit record under the given index, to be shown with loadOmittedRecords.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#relookup]\() Perform a relookup for the currently selected records Lookups are defined in the dataprovider (columns) auto\-enter setting and are normally performed over a relation upon record creation.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#relookup]\(index) Perform a relookup for the record under the given index Lookups are defined in the dataprovider (columns) auto\-enter setting and are normally performed over a relation upon record creation.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#removeFoundSetFilterParam]\(name) Remove a named foundset filter.{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}[Number]{td}{td}[#search]\(clearLastResults) 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}[Number]{td}{td}[#search]\(clearLastResults, reduceSearch) 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}[Boolean]{td}{td}[#selectRecord]\(pkid1, \[pkid2\], \[pkidn\]) Select the record based on pk data.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#setDataProviderValue]\(dataProviderID, value) Set a value based on a dataprovider name.{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}[#setSelectedIndexes]\(indexes) Set the selected records indexes.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#sort]\(sortString) Sorts the foundset based on the given sort string.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#sort]\(sortString, defer) Sorts the foundset based on the given sort string.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#sort]\(recordComparisonFunction) Sorts the foundset based on the given record comparator function.{td}{tr}{tbody}{tbody}{tr}{td}[JSFoundSet]{td}{td}[#unrelate]\() Create a new unrelated foundset that is a copy of the current foundset.{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}{tbody:id=alldataproviders}{tr:id=name}{td}h6.alldataproviders{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String]\[]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var dataprovidersNames = forms.customer.alldataproviders; application.output("This foundset has " + dataprovidersNames.length + " data providers.") for (var i=0; i<dataprovidersNames.length; i++) application.output(dataprovidersNames[i]); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=multiSelect}{tr:id=name}{td}h6.multiSelect{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} // allow user to select multiple rows. forms.customer.foundset.multiSelect = true; {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{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=addFoundSetFilterParam-String_String_Object}{tr:id=name}{td}h6.addFoundSetFilterParam{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}addFoundSetFilterParam{span}{span}\(dataprovider, operator, value){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} dataprovider -- String column to filter on. \{[String]} operator -- String operator: =, <, >, >=, <=, !=, (NOT) LIKE, (NOT) IN, (NOT) BETWEEN and IS (NOT) NULL optionally augmented with modifiers "#" (ignore case) or "^||" (or\-is\-null). \{[Object]} value -- Object filter value (for in array and between an array with 2 elements) {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if adding the filter succeeded, false otherwise.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} // Filter a fondset on a dataprovider value. // Note that multiple filters can be added to the same dataprovider, they will all be applied. var success = forms.customer.foundset.addFoundSetFilterParam('customerid', '=', 'BLONP', 'custFilter');//possible to add multiple forms.customer.foundset.loadAllRecords();//to make param(s) effective // Named filters can be removed using forms.customer.foundset.removeFoundSetFilterParam(filterName) {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=addFoundSetFilterParam-String_String_Object_String}{tr:id=name}{td}h6.addFoundSetFilterParam{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}addFoundSetFilterParam{span}{span}\(dataprovider, operator, value, name){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} dataprovider -- String column to filter on. \{[String]} operator -- String operator: =, <, >, >=, <=, !=, (NOT) LIKE, (NOT) IN, (NOT) BETWEEN and IS (NOT) NULL optionally augmented with modifiers "#" (ignore case) or "^||" (or\-is\-null). \{[Object]} value -- Object filter value (for in array and between an array with 2 elements) \{[String]} name -- String name, used to remove the filter again. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if adding the filter succeeded, false otherwise.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var success = forms.customer.foundset.addFoundSetFilterParam('customerid', '=', 'BLONP', 'custFilter');//possible to add multiple // Named filters can be removed using forms.customer.foundset.removeFoundSetFilterParam(filterName) // you can use modifiers in the operator as well, filter on companies where companyname is null or equals-ignore-case 'servoy' var ok = forms.customer.foundset.addFoundSetFilterParam('companyname', '#^||=', 'servoy') forms.customer.foundset.loadAllRecords();//to make param(s) effective {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=clear}{tr:id=name}{td}h6.clear{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}clear{span}{span}\(){span}{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} //Clear the foundset, including searches that may be on it forms.customer.foundset.clear(); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{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=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} 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=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} 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=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} 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=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} 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=duplicateFoundSet}{tr:id=name}{td}h6.duplicateFoundSet{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[JSFoundSet]{span}{span:style=font-weight: bold;}duplicateFoundSet{span}{span}\(){span}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[JSFoundSet] -- foundset duplicate.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var dupFoundset = forms.customer.foundset.duplicateFoundSet(); forms.customer.foundset.find(); //search some fields var count = forms.customer.foundset.search(); if (count == 0) { plugins.dialogs.showWarningDialog('Alert', 'No records found','OK'); forms.customer.foundset.loadRecords(dupFoundset); } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=duplicateRecord}{tr:id=name}{td}h6.duplicateRecord{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}duplicateRecord{span}{span}\(){span}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- 0 if record was not created or the record index if it was created.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} forms.customer.foundset.duplicateRecord(); forms.customer.foundset.duplicateRecord(false); //duplicate the current record, adds at bottom forms.customer.foundset.duplicateRecord(1,2); //duplicate the first record as second record //duplicates the record (record index 3), adds on top and selects the record forms.customer.foundset.duplicateRecord(3,true,true); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=duplicateRecord-Boolean}{tr:id=name}{td}h6.duplicateRecord{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}duplicateRecord{span}{span}\(onTop){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Boolean]} onTop -- when true the new record is added as the topmost record. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- 0 if record was not created or the record index if it was created.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} forms.customer.foundset.duplicateRecord(); forms.customer.foundset.duplicateRecord(false); //duplicate the current record, adds at bottom forms.customer.foundset.duplicateRecord(1,2); //duplicate the first record as second record //duplicates the record (record index 3), adds on top and selects the record forms.customer.foundset.duplicateRecord(3,true,true); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=duplicateRecord-Boolean_Boolean}{tr:id=name}{td}h6.duplicateRecord{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}duplicateRecord{span}{span}\(onTop, changeSelection){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Boolean]} onTop -- when true the new record is added as the topmost record. \{[Boolean]} changeSelection -- when true the selection is changed to the duplicated record. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- 0 if record was not created or the record index if it was created.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} forms.customer.foundset.duplicateRecord(); forms.customer.foundset.duplicateRecord(false); //duplicate the current record, adds at bottom forms.customer.foundset.duplicateRecord(1,2); //duplicate the first record as second record //duplicates the record (record index 3), adds on top and selects the record forms.customer.foundset.duplicateRecord(3,true,true); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=duplicateRecord-Number}{tr:id=name}{td}h6.duplicateRecord{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}duplicateRecord{span}{span}\(index){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} index -- The index of the record to duplicate; defaults to currently selected index. Ignored if first given parameter is a boolean value. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- 0 if record was not created or the record index if it was created.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} forms.customer.foundset.duplicateRecord(); forms.customer.foundset.duplicateRecord(false); //duplicate the current record, adds at bottom forms.customer.foundset.duplicateRecord(1,2); //duplicate the first record as second record //duplicates the record (record index 3), adds on top and selects the record forms.customer.foundset.duplicateRecord(3,true,true); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=duplicateRecord-Number_Boolean}{tr:id=name}{td}h6.duplicateRecord{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}duplicateRecord{span}{span}\(index, onTop){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} index -- The index of the record to duplicate; defaults to currently selected index. Ignored if first given parameter is a boolean value. \{[Boolean]} onTop -- when true the new record is added as the topmost record. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- 0 if record was not created or the record index if it was created.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} forms.customer.foundset.duplicateRecord(); forms.customer.foundset.duplicateRecord(false); //duplicate the current record, adds at bottom forms.customer.foundset.duplicateRecord(1,2); //duplicate the first record as second record //duplicates the record (record index 3), adds on top and selects the record forms.customer.foundset.duplicateRecord(3,true,true); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=duplicateRecord-Number_Boolean_Boolean}{tr:id=name}{td}h6.duplicateRecord{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}duplicateRecord{span}{span}\(index, onTop, changeSelection){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} index -- The index of the record to duplicate; defaults to currently selected index. Ignored if first given parameter is a boolean value. \{[Boolean]} onTop -- when true the new record is added as the topmost record. \{[Boolean]} changeSelection -- when true the selection is changed to the duplicated record. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- 0 if record was not created or the record index if it was created.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} forms.customer.foundset.duplicateRecord(); forms.customer.foundset.duplicateRecord(false); //duplicate the current record, adds at bottom forms.customer.foundset.duplicateRecord(1,2); //duplicate the first record as second record //duplicates the record (record index 3), adds on top and selects the record forms.customer.foundset.duplicateRecord(3,true,true); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=duplicateRecord-Number_Number}{tr:id=name}{td}h6.duplicateRecord{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}duplicateRecord{span}{span}\(index, location){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} index -- The index of the record to duplicate; defaults to currently selected index. Ignored if first given parameter is a boolean value. \{[Number]} location -- the new record is added at specified index {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- 0 if record was not created or the record index if it was created.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} forms.customer.foundset.duplicateRecord(); forms.customer.foundset.duplicateRecord(false); //duplicate the current record, adds at bottom forms.customer.foundset.duplicateRecord(1,2); //duplicate the first record as second record //duplicates the record (record index 3), adds on top and selects the record forms.customer.foundset.duplicateRecord(3,true,true); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=duplicateRecord-Number_Number_Boolean}{tr:id=name}{td}h6.duplicateRecord{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}duplicateRecord{span}{span}\(index, location, changeSelection){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} index -- The index of the record to duplicate; defaults to currently selected index. Ignored if first given parameter is a boolean value. \{[Number]} location -- the new record is added at specified index \{[Boolean]} changeSelection -- when true the selection is changed to the duplicated record. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- 0 if record was not created or the record index if it was created.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} forms.customer.foundset.duplicateRecord(); forms.customer.foundset.duplicateRecord(false); //duplicate the current record, adds at bottom forms.customer.foundset.duplicateRecord(1,2); //duplicate the first record as second record //duplicates the record (record index 3), adds on top and selects the record forms.customer.foundset.duplicateRecord(3,true,true); {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=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} 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=getCurrentSort}{tr:id=name}{td}h6.getCurrentSort{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getCurrentSort{span}{span}\(){span}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- String sort columns{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} //reverse the current sort //the original sort "companyName asc, companyContact desc" //the inversed sort "companyName desc, companyContact asc" var foundsetSort = foundset.getCurrentSort() var sortColumns = foundsetSort.split(',') var newFoundsetSort = '' for(var i=0; i<sortColumns.length; i++) { var currentSort = sortColumns[i] var sortType = currentSort.substring(currentSort.length-3) if(sortType.equalsIgnoreCase('asc')) { newFoundsetSort += currentSort.replace(' asc', ' desc') } else { newFoundsetSort += currentSort.replace(' desc', ' asc') } if(i != sortColumns.length - 1) { newFoundsetSort += ',' } } foundset.sort(newFoundsetSort) {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getDataProviderValue-String}{tr:id=name}{td}h6.getDataProviderValue{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Object]{span}{span:style=font-weight: bold;}getDataProviderValue{span}{span}\(dataProviderID){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} dataProviderID -- data provider name {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Object] -- Object value{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var val = forms.customer.foundset.getDataProviderValue('contact_name'); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getDataSource}{tr:id=name}{td}h6.getDataSource{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getDataSource{span}{span}\(){span}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- String data source.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var dataSource = forms.customer.foundset.getDataSource(); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getFoundSetFilterParams}{tr:id=name}{td}h6.getFoundSetFilterParams{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Object]\[]\[]{span}{span:style=font-weight: bold;}getFoundSetFilterParams{span}{span}\(){span}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Object]\[]\[] -- Array of filter definitions.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var params = foundset.getFoundSetFilterParams() for (var i = 0; params != null && i < params.length; i++) { application.output('FoundSet filter on table ' + params[i][0]+ ': '+ params[i][1]+ ' '+params[i][2]+ ' '+params[i][3] +(params[i][4] == null ? ' [no name]' : ' ['+params[i][4]+']')) } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getFoundSetFilterParams-String}{tr:id=name}{td}h6.getFoundSetFilterParams{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Object]\[]\[]{span}{span:style=font-weight: bold;}getFoundSetFilterParams{span}{span}\(filterName){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} filterName -- name of the filter to retrieve. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Object]\[]\[] -- Array of filter definitions.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var params = foundset.getFoundSetFilterParams() for (var i = 0; params != null && i < params.length; i++) { application.output('FoundSet filter on table ' + params[i][0]+ ': '+ params[i][1]+ ' '+params[i][2]+ ' '+params[i][3] +(params[i][4] == null ? ' [no name]' : ' ['+params[i][4]+']')) } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getQuery}{tr:id=name}{td}h6.getQuery{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[QBSelect]{span}{span:style=font-weight: bold;}getQuery{span}{span}\(){span}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[QBSelect] -- query.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var q = foundset.getQuery() q.where.add(q.columns.x.eq(100)) foundset.loadRecords(q); {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=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} var record = forms.customer.foundset.getRecord(index); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getRecordIndex-JSRecord}{tr:id=name}{td}h6.getRecordIndex{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}getRecordIndex{span}{span}\(record){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[JSRecord]} record -- Record {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- int index.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var index = forms.customer.foundset.getRecordIndex(record); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getRelationName}{tr:id=name}{td}h6.getRelationName{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getRelationName{span}{span}\(){span}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- String relation name when related.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var relName = forms.customer.foundset.getRelationName(); {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=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} //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=getSelectedIndexes}{tr:id=name}{td}h6.getSelectedIndexes{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]\[]{span}{span:style=font-weight: bold;}getSelectedIndexes{span}{span}\(){span}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number]\[] -- Array current indexes (1-based){div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} // modify selection to the first selected item and the following row only var current = forms.customer.foundset.getSelectedIndexes(); if (current.length > 1) { var newSelection = new Array(); newSelection[0] = current[0]; // first current selection newSelection[1] = current[0] + 1; // and the next row forms.customer.foundset.setSelectedIndexes(newSelection); } {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=ret}{td}*Returns*\\{div:class=sIndent}[JSRecord] -- Record record.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var selectedRecord = forms.customer.foundset.getSelectedRecord(); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getSelectedRecords}{tr:id=name}{td}h6.getSelectedRecords{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[JSRecord]\[]{span}{span:style=font-weight: bold;}getSelectedRecords{span}{span}\(){span}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[JSRecord]\[] -- Array current records.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var selectedRecords = forms.customer.foundset.getSelectedRecords(); {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=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- int current size.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} 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=hasConditions}{tr:id=name}{td}h6.hasConditions{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}hasConditions{span}{span}\(){span}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- wether the foundset has find-conditions{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} if (forms.customer.foundset.hasConditions()) { // foundset had find actions } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=invertRecords}{tr:id=name}{td}h6.invertRecords{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}invertRecords{span}{span}\(){span}{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} forms.customer.foundset.invertRecords(); {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=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} //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=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} forms.customer.foundset.loadAllRecords(); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=loadOmittedRecords}{tr:id=name}{td}h6.loadOmittedRecords{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}loadOmittedRecords{span}{span}\(){span}{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} forms.customer.foundset.loadOmittedRecords(); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=loadRecords}{tr:id=name}{td}h6.loadRecords{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}loadRecords{span}{span}\(){span}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if successful{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} //to reload all last (related) records again, if for example when searched in tabpanel forms.customer.foundset.loadRecords(); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=loadRecords-JSFoundSet}{tr:id=name}{td}h6.loadRecords{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}loadRecords{span}{span}\(foundset){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[JSFoundSet]} foundset -- The foundset to load records from {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if successful{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} //Copies foundset data from another foundset forms.customer.foundset.loadRecords(fs); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=loadRecords-JSDataSet}{tr:id=name}{td}h6.loadRecords{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}loadRecords{span}{span}\(dataset){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[JSDataSet]} dataset -- pkdataset {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if successful{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} // loads a primary key dataset, will remove related sort! //var dataset = databaseManager.getDataSetByQuery(...); // dataset must match the table primary key columns (alphabetically ordered) forms.customer.foundset.loadRecords(dataset); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=loadRecords-QBSelect}{tr:id=name}{td}h6.loadRecords{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}loadRecords{span}{span}\(querybuilder){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[QBSelect]} querybuilder -- the query builder {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if successful{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} forms.customer.foundset.loadRecords(qbselect); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=loadRecords-UUID}{tr:id=name}{td}h6.loadRecords{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}loadRecords{span}{span}\(uuidpk){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[UUID]} uuidpk -- single\-column pk value {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if successful{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} //Loads a single record by primary key, will remove related sort! forms.customer.foundset.loadRecords(application.getUUID('6b5e2f5d-047e-45b3-80ee-3a32267b1f20')); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=loadRecords-Number}{tr:id=name}{td}h6.loadRecords{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}loadRecords{span}{span}\(numberpk){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} numberpk -- single\-column pk value {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if successful{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} //Loads a single record by primary key, will remove related sort! forms.customer.foundset.loadRecords(123); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=loadRecords-String}{tr:id=name}{td}h6.loadRecords{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}loadRecords{span}{span}\(queryString){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} queryString -- select statement {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if successful{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} //loads records in to the foundset based on a query (also known as 'Form by query') forms.customer.foundset.loadRecords(sqlstring); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=loadRecords-String_ObjectArray}{tr:id=name}{td}h6.loadRecords{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}loadRecords{span}{span}\(queryString, argumentsArray){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} queryString -- select statement \{[Object]\[]} argumentsArray -- arguments to query {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if successful{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} //loads records in to the foundset based on a query (also known as 'Form by query') forms.customer.foundset.loadRecords(sqlstring,parameters); {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=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} // 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=newRecord-Boolean}{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}\(onTop){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Boolean]} onTop -- when true the new record is added as the topmost 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} // 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=newRecord-Boolean_Boolean}{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}\(onTop, changeSelection){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Boolean]} onTop -- when true the new record is added as the topmost record. \{[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} // 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=newRecord-Number}{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}\(index){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} index -- the new record is added at specified index. {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} // 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=newRecord-Number_Boolean}{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}\(index, changeSelection){span}{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} // 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=omitRecord}{tr:id=name}{td}h6.omitRecord{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}omitRecord{span}{span}\(){span}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- boolean true if all records could be omitted.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var success = forms.customer.foundset.omitRecord(); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=omitRecord-Number}{tr:id=name}{td}h6.omitRecord{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}omitRecord{span}{span}\(index){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} index -- The index of the record to omit. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- boolean true if all records could be omitted.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var success = forms.customer.foundset.omitRecord(); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=relookup}{tr:id=name}{td}h6.relookup{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}relookup{span}{span}\(){span}{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} forms.customer.foundset.relookup(1); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=relookup-Number}{tr:id=name}{td}h6.relookup{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}relookup{span}{span}\(index){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} index -- record index (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} forms.customer.foundset.relookup(1); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=removeFoundSetFilterParam-String}{tr:id=name}{td}h6.removeFoundSetFilterParam{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}removeFoundSetFilterParam{span}{span}\(name){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} name -- String filter name. {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if removing the filter succeeded, false otherwise.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var success = forms.customer.foundset.removeFoundSetFilterParam('custFilter');// removes all filters with this name forms.customer.foundset.loadAllRecords();//to make param(s) effective {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=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- the recordCount{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} 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=search-Boolean}{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}\(clearLastResults){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Boolean]} clearLastResults -- boolean, clear previous search, default true {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} 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=search-Boolean_Boolean}{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}\(clearLastResults, reduceSearch){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Boolean]} clearLastResults -- boolean, clear previous search, default true \{[Boolean]} reduceSearch -- boolean, reduce (true) or extend (false) previous search results, default true {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} 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=selectRecord-__}{tr:id=name}{td}h6.selectRecord{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}selectRecord{span}{span}\(pkid1, \[pkid2\], \[pkidn\]){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}pkid1 -- primary key \[pkid2\] -- second primary key (in case of composite primary key) \[pkidn\] -- nth primary key {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if succeeded.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} forms.customer.foundset.selectRecord(pkid1,pkid2,pkidn);//pks must be alphabetically set! It is also possible to use an array as parameter. {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=setDataProviderValue-String_Object}{tr:id=name}{td}h6.setDataProviderValue{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}setDataProviderValue{span}{span}\(dataProviderID, value){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} dataProviderID -- data provider name \{[Object]} value -- value to set {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} forms.customer.foundset.setDataProviderValue('contact_name','mycompany'); {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=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} //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=setSelectedIndexes-NumberArray}{tr:id=name}{td}h6.setSelectedIndexes{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}setSelectedIndexes{span}{span}\(indexes){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]\[]} indexes -- An array with indexes to set. {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} // modify selection to the first selected item and the following row only var current = forms.customer.foundset.getSelectedIndexes(); if (current.length > 1) { var newSelection = new Array(); newSelection[0] = current[0]; // first current selection newSelection[1] = current[0] + 1; // and the next row forms.customer.foundset.setSelectedIndexes(newSelection); } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=sort-String}{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}\(sortString){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} sortString -- the specified columns (and sort order) {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} forms.customer.foundset.sort('columnA desc,columnB asc'); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=sort-String_Boolean}{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}\(sortString, defer){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} sortString -- the specified columns (and sort order) \{[Boolean]} defer -- when true, the "sortString" will be just stored, without performing a query on the database (the actual sorting will be deferred until the next data loading action). {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} forms.customer.foundset.sort('columnA desc,columnB asc'); {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=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} 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}{tbody:id=unrelate}{tr:id=name}{td}h6.unrelate{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[JSFoundSet]{span}{span:style=font-weight: bold;}unrelate{span}{span}\(){span}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[JSFoundSet] -- FoundSet unrelated foundset.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} forms.customer.foundset.unrelate(); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table} |