Child pages
  • JSFoundSetUpdater

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table Cell (td)
Boolean

...

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 'class' inside the {div} macro with 'id=description'
Divcache
styleindexdisplay:none

...

iddescription

...

padding0px
width80px

...

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

...

true
refresh100d
showRefreshtrue
iddoc
titleRefresh page
showDatetrue
retryEnable

servoy sReturnTypes2100%height: 30px;2Supported ClientssWordListSmartClientsWordListWebClientsWordListNGClient

servoy sSummary12%30%58%height: 30px;3Methods SummaryGo to next record in this updater, returns true if successful.

...

Table Cell (td)
Boolean
Do the actual update in the database, returns true if successful.

...

void

...

Start over with this iterator 'next' function (at the foundset selected record).

...

Table Cell (td)
Boolean

...

Set the column value to update, returns true if successful.

...

function

...

servoy sDetail

...

padding0px
width100%

...

2100%height:30px

...

Table Head (th)
colspan1
Method Details

...

idnext
Table Row (tr)
idname
Table Cell (td)
next
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
next
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Go to next record in this updater, returns true if successful.

...

idret

...

classsIndent

...

2Methods Detailsnextname

next()

dessIndent
Go to next record in this updater, returns true if successful.
NOTE: this method doesn't take into account deletes and inserts that may happen at same time. For more reliable iterator see foundset.forEach
ret

Returns

sIndent true if proceeded to next record, false otherwise
clients

...

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

...

classlastDetailRow

...

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

Do the actual update in the database, returns true if successful.
There are 3 types of possible use with the foundset updater
1) update entire foundset by a single sql statement; that is not possible when the table of the foundset has tracking enabled then it will loop over the whole foundset.
When a single sql statement is done, modification columns will not be updated, because it does the update directly in the database, without getting the records.
2) update part of foundset, for example the first 4 row (starts with selected row)
3) safely loop through foundset (starts with selected row)

after the perform update call there are no records in edit mode, that where not already in edit mode, because all of them are saved directly to the database,
or in mode 1 the records are not touched at all and the database is updated directly.

...

idret

...

classsIndent

...

Sample

...

classsIndent

...

Code Block
languagejavascript
controller.setSelectedIndex(1)
var count = 0
var fsUpdater = databaseManager.getFoundSetUpdater(foundset)
while(fsUpdater.next())
{
	fsUpdater.setColumn('my_flag',count++)
}

...

sIdentjavascriptlastDetailRowperformUpdatename

performUpdate()

dessIndent
Do the actual update in the database, returns true if successful. It will first try to save all editing records (from all foundsets), if cannot save will return false before doing the update.
There are 3 types of possible use with the foundset updater
1) update entire foundset by a single sql statement; that is not possible when the table of the foundset has tracking enabled then it will loop over the whole foundset.
   When a single sql statement is done, modification columns will not be updated and associated Table Events won't be triggered, because it does the update directly in the database, without getting the records.
  NOTE: this mode will refresh all foundsets based on same datasource
2) update part of foundset, for example the first 4 row (starts with selected row)
3) safely loop through foundset (starts with selected row)

after the perform update call there are no records in edit mode, that where not already in edit mode, because all of them are saved directly to the database,
or in mode 1 the records are not touched at all and the database is updated directly.
ret

Returns

sIndent true if succeeded, false if failed.
clients

...

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

...

Sample

...

classsIndent

...

Code Block
languagejavascript
//1) update entire foundset
var fsUpdater = databaseManager.getFoundSetUpdater(foundset)
fsUpdater.setColumn('customer_type',1)
fsUpdater.setColumn('my_flag',0)
fsUpdater.performUpdate()

//2) update part of foundset, for example the first 4 row (starts with selected row)
var fsUpdater = databaseManager.getFoundSetUpdater(foundset)
fsUpdater.setColumn('customer_type',new Array(1,2,3,4))
fsUpdater.setColumn('my_flag',new Array(1,0,1,0))
fsUpdater.performUpdate()

//3) safely loop through foundset (starts with selected row)
controller.setSelectedIndex(1)
var count = 0
var fsUpdater = databaseManager.getFoundSetUpdater(foundset)
while(fsUpdater.next())
{
	fsUpdater.setColumn('my_flag',count++)
}

...

classlastDetailRow

...

idresetIterator
Table Row (tr)
idname
Table Cell (td)
resetIterator
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
resetIterator
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Start over with this iterator 'next' function (at the foundset selected record).
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
controller.setSelectedIndex(1)
var count = 0
var fsUpdater = databaseManager.getFoundSetUpdater(foundset)
while(fsUpdater.next())
{
	fsUpdater.setColumn('my_flag',++count)
}
fsUpdater.resetIterator()
while(fsUpdater.next())
{
	fsUpdater.setColumn('max_flag',count)
}

...

classlastDetailRow

...

idsetColumn-String_Object
Table Row (tr)
idname
Table Cell (td)
setColumn
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
setColumn
Span
(name, value)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Set the column value to update, returns true if successful.

...

idprs

...

classsIndent

...

sIdentjavascriptlastDetailRowresetIteratorname

resetIterator()

dessIndent
Start over with this iterator 'next' function (at the foundset selected record).
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
setColumnname

setColumn(name, value)

dessIndent
Set the column value to update, returns true if successful.
prs

Parameters

sIndentnameThe name of the column to update.

...

value

...

The new value (can be an array with data for x number of rows) to be stored in the specified column.

...

ret

...

Returns

...

sIndent

...

classlastDetailRow

...

true if succeeded, false if failed.clients

Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//1) update entire foundset
var fsUpdater = databaseManager.getFoundSetUpdater(foundset)
fsUpdater.setColumn('customer_type',1)
fsUpdater.setColumn('my_flag',0)
fsUpdater.performUpdate()

//2) update part of foundset, for example the first 4 row (starts with selected row)
var fsUpdater = databaseManager.getFoundSetUpdater(foundset)
fsUpdater.setColumn('customer_type',new Array(1,2,3,4))
fsUpdater.setColumn('my_flag',new Array(1,0,1,0))
fsUpdater.performUpdate()

//3) safely loop through foundset (starts with selected row)
controller.setSelectedIndex(1)
var count = 0
var fsUpdater = databaseManager.getFoundSetUpdater(foundset)
while(fsUpdater.next())
{
	fsUpdater.setColumn('my_flag',count++)
}

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow