Child pages
  • JSFoundSetUpdater

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{hiddendiv: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 EXTRACTAUTO CHANGES FROMUPDATE THE PAGECONTENT ANDTHROUGH MERGETHE THEM BACK INTO SERVOY SOURCE{hiddenDOC GENERATOR{div}
{sub-sectiondiv:id=description|text=}{sub-sectiondiv}\\ 

{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}[#next]\()
Go to next record in this updater, returns true if successful.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#performUpdate]\()
Do the actual update in the database, returns true if successful.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#resetIterator]\()
Start over with this iterator 'next' function (at the foundset selected record).{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#setColumn]\(name, value)
Set the column value to update, returns true if successful.{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=next|class=node}{tr:id=name}{td}h6.next{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}next{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{builder-show:permission=edit}{tr:id=des}{td}{sub-section:next_des|trigger=button|text=}{sub-section}{sub-section:next_des|trigger=none|class=sIndent}Replace with description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:next_snc|trigger=button|text=}{sub-section}{sub-section:next_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:next_prs|trigger=button|text=}{sub-section}{sub-section:next_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:next_ret|trigger=button|text=}{sub-section}{sub-section:next_ret|trigger=none|div:class=sIndent}[Boolean] -- true if proceeded to next record, false otherwise{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:next_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:next_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:next_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:next_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:next_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:next_sam|trigger=none}{code:language=javascript}
controller.setSelectedIndex(1)
var count = 0
var fsUpdater = databaseManager.getFoundSetUpdater(foundset)
while(fsUpdater.next())
{
	fsUpdater.setColumn('my_flag',count++)
}
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=performUpdate|class=node}{tr:id=name}{td}h6.performUpdate{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}performUpdate{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{builder-show:permission=edit}{tr:id=des}{td}{sub-section:performUpdate_des|trigger=button|text=}{sub-section}{sub-section:performUpdate_des|trigger=none|class=sIndent}Replace with description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:performUpdate_snc|trigger=button|text=}{sub-section}{sub-section:performUpdate_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:performUpdate_prs|trigger=button|text=}{sub-section}{sub-section:performUpdate_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:performUpdate_ret|trigger=button|text=}{sub-section}{sub-section:performUpdate_ret|trigger=none|div:class=sIndent}[Boolean] -- true if succeeded, false if failed.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:performUpdate_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:performUpdate_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:performUpdate_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:performUpdate_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:performUpdate_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:performUpdate_sam|trigger=none}{code:language=javascript}
//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++)
}
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=resetIterator|class=node}{tr:id=name}{td}h6.resetIterator{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}void{span}{span:id=iets|style=float: left; font-weight: bold;}resetIterator{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{builder-show:permission=edit}{tr:id=des}{td}{sub-section:resetIterator_des|trigger=button|text=}{sub-section}{sub-section:resetIterator_des|trigger=none|class=sIndent}Replace with description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:resetIterator_snc|trigger=button|text=}{sub-section}{sub-section:resetIterator_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:resetIterator_prs|trigger=button|text=}{sub-section}{sub-section:resetIterator_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:resetIterator_ret|trigger=button|text=}{sub-section}{sub-section:resetIterator_ret|trigger=none|div:class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:resetIterator_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:resetIterator_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:resetIterator_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:resetIterator_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:resetIterator_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:resetIterator_sam|trigger=none}{code:language=javascript}
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)
}
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=setColumn-String_Object|class=node}{tr:id=name}{td}h6.setColumn{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}setColumn{span}{span:id=iets|style=float: left;}\(name, value){span}{td}{tr}{builder-show:permission=edit}{tr:id=des}{td}{sub-section:setColumn-String_Object_des|trigger=button|text=}{sub-section}{sub-section:setColumn-String_Object_des|trigger=none|class=sIndent}Replace with description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:setColumn-String_Object_snc|trigger=button|text=}{sub-section}{sub-section:setColumn-String_Object_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:setColumn-String_Object_prs|trigger=button|text=}{sub-section}{sub-section:setColumn-String_Object_prs|trigger=none|div:class=sIndent}\{[String]} name -- The name of the column to update.
\{[Object]} value -- The new value (can be an array with data for x number of rows) to be stored in the specified column.
{sub-sectiondiv}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:setColumn-String_Object_ret|trigger=button|text=}{sub-section}{sub-section:setColumn-String_Object_ret|trigger=none|div:class=sIndent}[Boolean] -- true if succeeded, false if failed.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:setColumn-String_Object_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:setColumn-String_Object_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:setColumn-String_Object_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:setColumn-String_Object_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:setColumn-String_Object_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:setColumn-String_Object_sam|trigger=none}{code:language=javascript}
//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++)
}
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}