Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Cache
indextrue
refresh100d
showRefreshtrue
iddoc
showRefreshtrue
titleRefresh page
showDatetrue
retryEnable

servoy sReturnTypes2100%height: 30px;2Supported ClientssWordListINLINESmartClientsWordListINLINEWebClientsWordListINLINENGClient

servoy sSummary12%30%58%height: 30px;3Constants SummaryConstant for the flags in #enableDatabroadcastFor(QBTableClause,int) to listen for changes in columns (selected) of the given datasource in the query that can affect aggregates.Constant for the flags in #enableDatabroadcastFor(QBTableClause,int) to listen also for column changes of the given table/datasource.Constant for the flags in #enableDatabroadcastFor(QBTableClause,int) to listen for deletes on the given table/datasource.Constant for the flags in #enableDatabroadcastFor(QBTableClause,int) to listen for deletes on the given table/datasource which should be the primary/main table of this query.Constant for the flags in #enableDatabroadcastFor(QBTableClause,int) to listen for inserts on the given table/datasource.Constant for the flags in #enableDatabroadcastFor(QBTableClause,int) to listen also for column changes of the given table/datasource in the join statement Like - like order_lines.Constant for the flags in #enableDatabroadcastFor(QBTableClause,int) to listen also for column changes of the given table/datasource that are used in the where statement - like order_lines.

servoy sSummary12%30%58%height: 30px;3Property SummaryReturns true if this foundset is in multiselect mode and false if it's in single-select mode.voidPuts this foundset in multi-select or single-select mode.

servoy sSummary12%30%58%height: 30px;3Methods SummaryvoidDispose and unregisters a view foundset from memory when is no longer needed.voidDatabroadcast can be enabled per select table of a query, the select table can be the main QBSelect or on of it QBJoins By default this monitors only the column values that are in the result of the QBSelect, you can only enable this default monitoring for a table if for that table also the PK is selected in the results.voidEnable the databroadcast for a specific table of the QBSelect or QBJoin with flags for looking for join or where criteria or deletes/inserts.Iterates over the records of a foundset taking into account inserts and deletes that may happen at the same time.Iterates over the records of a foundset taking into account inserts and deletes that may happen at the same time.Returns the datasource (view:name) for this ViewFoundSet.Get the cloned query that created this ViewFoundSset (modifying this QBSelect will not change the foundset).Get the ViewRecord object at the given index.Get the number of records in this viewfoundset.voidThis will reload the current set of ViewRecords in this foundset, resetting the chunk size back to the start (default 200).Saves all records in the view foundset that have changes.Saved a specific record of this foundset.voidSorts the foundset based on the given record comparator function.

constantservoy sDetail2100%height:30px2Constants DetailsMONITOR_AGGREGATESname

MONITOR_AGGREGATES

dessIndent
Constant for the flags in #enableDatabroadcastFor(QBTableClause,int) to listen for changes in
columns (selected) of the given datasource in the query that can affect aggregates. This means that when
there are deletes, inserts or updates on columns selected from that datasource, a full re-query will
happen 
-
to refresh the aggregates.

IMPORTANT: in general, this flag should be set on (possible multiple) datasources from the query that
have group by on their columns, and the columns don't contain the pk, or that have the actual aggregates
on their columns (because all those could influence the value of aggregates).

For example (ignoring the fact that in a real-life situation these fields might not change), a view
foundset based on this query:

SELECT orders.customerid, orders.orderdate, SUM(order_details.unitprice) FROM orders
   LEFT OUTER JOIN order_details ON orders.orderid = order_details.orderid
   GROUP BY orders.customerid, orders.orderdate
	  ORDER BY orders.customerid asc, orders.orderdate desc

will want to enable databroadcast flag MONITOR_AGGREGATES on both "orders" (because if "orderdate" or
"customerid" - that are used in GROUP BY - change/are corrected on a row, that row could move from one
group to the other, affecting the SUM(order_details.unitprice) for the groups involved) and "order_details"
(because if "unitprice" changes/is corrected, the aggregate will be affected).

But if the above query would also select the orders.odersid (and also group by that) then the orders row
that you select for that sum will always be unique and only #MONITOR_COLUMNS has to be 
done
used for
those - if needed.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRowMONITOR_COLUMNSname

MONITOR_COLUMNS

des
sIndent
Constant for the flags in #enableDatabroadcastFor(QBTableClause,int) to listen also for column
changes of the given table/datasource. This is used by default 
if you just use enableDatabroadcastFor()
without flags. 
If you use the one with the flags you need to give this one if you just want to listen to
column changes that are in the result for a given datasource and pk.

This constants needs to have the pk's selected for the given datasource (should be in the results).
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRowMONITOR_DELETESname

MONITOR_DELETES

des
sIndent
Constant for the flags in #enableDatabroadcastFor(QBTableClause,int) to listen for deletes on the
given table/datasource. This will always result in a full query to detect changes whenever an delete 
on
that table happens.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRowMONITOR_DELETES_FOR_PRIMARY_TABLEname

MONITOR_DELETES_FOR_PRIMARY_TABLE

des
sIndent
Constant for the flags in #enableDatabroadcastFor(QBTableClause,int) to listen for deletes on the
given table/datasource which should be the primary/main table of this query. If a delete comes in for this
table, then we will only remove the records from the ViewFoundSet that do have this primary key in its
value. So no need to do a full query. So this will only work if the query shows order_lines for the
order_lines table, not for the products table that is joined to get the product_name. Only 1 of the 2
monitors for deletes should be registered for a table/datasource.

This constants needs to have the pk's selected for the given datasource (should be in the results)
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRowMONITOR_INSERTname

MONITOR_INSERT

des
sIndent
Constant for the flags in #enableDatabroadcastFor(QBTableClause,int) to listen for inserts on the
given table/datasource. This will always result in a full query to detect changes whenever an insert on
that table happens.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRowMONITOR_JOIN_CONDITIONSname

MONITOR_JOIN_CONDITIONS

des
sIndent
Constant for the flags in #enableDatabroadcastFor(QBTableClause,int) to listen also for column
changes of the given table/datasource in the join statement 
Like
- like order_lines.productid that has a join
to orders and is displaying the productname. If a change in such a join condition (like
order_lines.productid in the sample above) is seen then the query will be fired again to detect changes.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRowMONITOR_WHERE_CONDITIONSname

MONITOR_WHERE_CONDITIONS

des
sIndent
Constant for the flags in #enableDatabroadcastFor(QBTableClause,int) to listen also for column
changes of the given table/datasource that are used in the where statement
.
 
Like
- like
order_lines.unit_price > 100. If a change is seen on that datasource on such a column used in the where
a full query will be fired again to detect changes.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
VIEW_FOUNDSETname

VIEW_FOUNDSET

dessIndentret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRow

propertyservoy sDetail2100%height:30px2Property DetailsmultiSelectname

multiSelect

dessIndent
Returns true if this foundset is in multiselect mode and false if it's in single-select mode.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRowsetMultiSelectname

setMultiSelect

des
sIndent
Puts this foundset in multi-select or single-select mode. If this foundset is shown in a form, this call can be
ignored as the form decides the foundset's multiselect.
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRow

functionservoy sDetail2100%height:30px2Methods Detailsdisposename

enableDatabroadcastFornameenableDatabroadcastFor

dispose()

dessIndent
Dispose and unregisters a view foundset from memory when is no longer needed.
Returns whether foundset was disposed.
If linked to visible form or component, view foundset cannot be disposed.

Normally ViewFoundSets are not hold on to by the system, so if you only use this inside a method it will be disposed by itself.
This method is then just helps by also calling clear()

For ViewFoundSets that are also registered  by using true as the last argument in the call: databaseMananager.getViewFoundSet(name, query, boolean register)
are hold on to by the system and Forms can use it for there foundset. Calling dispose on those will remove it from the system, so it is not usable anymore in forms.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
enableDatabroadcastForname

enableDatabroadcastFor(queryTable)

des
sIndent
Databroadcast can be enabled per select table of a query, the select table can be the main QBSelect or on of it QBJoins
By default this monitors only the column values that are in the result of the QBSelect, you can only enable this default monitoring for a table if for that table also the PK is selected in the results.

you can use #enableDatabroadcastFor(QBTableClause,int) to specify what should be monitored more besides pure column values per pk.
Those have impact on performance because for the most part if we see a hit then a full query is done to see if there are changes.
prs

Parameters

sIndent
queryTableThe QBSelect or QBJoin of a full query where this foundset should listen for data changes.clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRowenableDatabroadcastForname

enableDatabroadcastFor(

queryTable

queryTableclause, flags)

des
sIndent
Enable the databroadcast for a specific table of the QBSelect or QBJoin with  flags for looking for join or where criteria or deletes/inserts.
These  flags can be a performance hit because the query needs to be executed again to see if there are any changes.
For certain flags #MONITOR_COLUMNS and #MONITOR_DELETES_FOR_PRIMARY_TABLE the pk for that table must be in the results.
prs

Parameters

sIndent
queryTablequeryTableclauseThe QBSelect or QBJoin of a full query where this foundset should listenn listen for data changes.flagsOne or more of the ViewFoundSet.XXX flags added to each other.clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRowforEachname

forEach(callback)

des
sIndent
Iterates over the records of a foundset taking into account inserts and deletes that may happen at the same time.
It will dynamically load all records in the foundset (using Servoy lazy loading mechanism). If callback function returns a non null value the traversal will be stopped and that value is returned.
If no value is returned all records of the foundset will be traversed. Foundset modifications( like sort, omit...) cannot be performed in the callback function.
If foundset is modified an exception will be thrown. This exception will also happen if a refresh happens because of a rollback call for records on this datasource when iterating.
When an exception is thrown from the callback function, the iteraion over the foundset will be stopped.
prs

Parameters

sIndent
callbackThe callback function to be called for each loaded record in the foundset. Can receive three parameters: the record to be processed, the index of the record in the foundset, and the foundset that is traversed.ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRowforEachname

forEach(callback, thisObject)

des
sIndent
Iterates over the records of a foundset taking into account inserts and deletes that may happen at the same time.
It will dynamically load all records in the foundset (using Servoy lazy loading mechanism). If callback function returns a non null value the traversal will be stopped and that value is returned.
If no value is returned all records of the foundset will be traversed. Foundset modifications( like sort, omit...) cannot be performed in the callback function.
If foundset is modified an exception will be thrown. This exception will also happen if a refresh happens because of a rollback call for records on this datasource when iterating.
When an exception is thrown from the callback function, the iteraion over the foundset will be stopped.
prs

Parameters

sIndent
callbackThe callback function to be called for each loaded record in the foundset. Can receive three parameters: the record to be processed, the index of the record in the foundset, and the foundset that is traversed.thisObjectWhat the this object should be in the callback function (default it is the foundset)ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRowgetDataSourcename

getDataSource()

des
sIndent
Returns the datasource (view:name) for this ViewFoundSet.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRowgetQueryname

getQuery()

des
sIndent
Get the cloned query that created this ViewFoundSset (modifying this QBSelect will not change the foundset).
The ViewFoundSets main query can't be altered after creation; you need to make a new ViewFoundSet for that (it can have the same datasource name).
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRowgetRecordname

getRecord(index)

des
sIndent
Get the ViewRecord object at the given index.
Argument "index" is 1 based (so first record is 1).
prs

Parameters

sIndent
indexrecord index (1 based).ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRowgetSelectedRecordname

getSelectedRecord()

des
sIndentret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRowgetSizename

getSize()

des
sIndent
Get the number of records in this viewfoundset.
This is the number of records loaded, note that when looping over a foundset, size() may
increase as more records are loaded.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRowloadAllRecordsname

loadAllRecords()

des
sIndent
This will reload the current set of ViewRecords in this foundset, resetting the chunk size back to the start (default 200).
All edited records will be discarded! So this can be seen as a full clean up of this ViewFoundSet.
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRowsavename

save()

des
sIndent
Saves all records in the view foundset that have changes.
You can only save columns from a table if the pks of that table are also selected by the view foundset's query.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRowsavename

save(record)

des
sIndent
Saved a specific record of this foundset.
You can only save columns from a table if also the pk is selected of that table
prs

Parameters

sIndent
record ;ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRowsortname

sort(recordComparisonFunction)

des
sIndent
Sorts the foundset based on the given record comparator function.
Tries to preserve selection based on primary key. If first record is selected or cannot select old record it will select first record after sort.
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
prs

Parameters

sIndent
recordComparisonFunctionrecord comparator functionclients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdent
javascriptlastDetailRow