Child pages
  • JSRecord

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{hidden}
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY, UNLESS YOU KNOW WHAT YOU'RE DOING.
		THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO EXTRACT CHANGES FROM THE PAGE AND MERGE THEM BACK INTO SERVOY SOURCE{hidden}
{sub-section:description|text=}{sub-section}\\{table:class=servoy sSummery}{colgroup}{column:width=80px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method Summary{th}{tr}{tbody}{tr}{td}[JSDataSet]{td}{td}[#getChangedData]\()
Returns a JSDataSet with outstanding (not saved) changed data of this record.{td}{tr}{tbody}{tbody}{tr}{td}Object[]{td}{td}[#getPKs]\()
Returns an array with the primary key values of the record.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#isEditing]\()
Returns true or false if the record is being edited or not.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#rollbackChanges]\()
If this record exists in underlying datasource it will do a re-query to fetch the latest data from the datasource.{td}{tr}{tbody}{table}\\{table:class=servoy sDetail}{colgroup}{column:width=100%}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Method Details{th}{tr}{tbody:id=8463D7D87A274570-46B59BC2-43264CC1-835687AB-3B314072DDE55040D8288B4A}{tr:id=name}{td}h6.getChangedData{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSDataSet]{span}{span:id=iets|style=float: left; font-weight: bold;}getChangedData{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:8463D7D87A274570-46B59BC2-43264CC1-835687AB-3B314072DDE55040D8288B4A_des|text=|trigger=button}{sub-section}{sub-section:8463D7D87A274570-46B59BC2-43264CC1-835687AB-3B314072DDE55040D8288B4A_des|trigger=none|class=sIndent}Returns a JSDataSet with outstanding (not saved) changed data of this record.

NOTE: To return an array of records with outstanding changed data, see the function databaseManager.getEditedRecords().{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:8463D7D87A274570-46B59BC2-43264CC1-835687AB-3B314072DDE55040D8288B4A_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:8463D7D87A274570-46B59BC2-43264CC1-835687AB-3B314072DDE55040D8288B4A_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:8463D7D87A274570-46B59BC2-43264CC1-835687AB-3B314072DDE55040D8288B4A_ret|text=|trigger=button}{sub-section}{sub-section:8463D7D87A274570-46B59BC2-43264CC1-835687AB-3B314072DDE55040D8288B4A_ret|trigger=none|class=sIndent}[JSDataSet] -- a JSDataSet with the changed data of this record.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:8463D7D87A274570-46B59BC2-43264CC1-835687AB-3B314072DDE55040D8288B4A_see|text=|trigger=button}{sub-section}{sub-section:8463D7D87A274570-46B59BC2-43264CC1-835687AB-3B314072DDE55040D8288B4A_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:8463D7D87A274570-46B59BC2-43264CC1-835687AB-3B314072DDE55040D8288B4A_see|text=|trigger=button}{sub-section}{sub-section:8463D7D87A274570-46B59BC2-43264CC1-835687AB-3B314072DDE55040D8288B4A_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:8463D7D87A274570-46B59BC2-43264CC1-835687AB-3B314072DDE55040D8288B4A_sam|text=|trigger=button}{sub-section}{sub-section:8463D7D87A274570-46B59BC2-43264CC1-835687AB-3B314072DDE55040D8288B4A_sam|class=sIndent|trigger=none}{code:language=javascript}
var dataset = record.getChangedData()
for( var i = 1 ; i <= dataset.getMaxRowIndex() ; i++ )
{
	application.output(dataset.getValue(i,1) +' '+ dataset.getValue(i,2) +' '+ dataset.getValue(i,3));
}
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=E522D63523A424C6-9D951192-4BAC4570-80328F6E-70523E1AE2997C8D48CAB26A}{tr:id=name}{td}h6.getPKs{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}Object[]{span}{span:id=iets|style=float: left; font-weight: bold;}getPKs{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:E522D63523A424C6-9D951192-4BAC4570-80328F6E-70523E1AE2997C8D48CAB26A_des|text=|trigger=button}{sub-section}{sub-section:E522D63523A424C6-9D951192-4BAC4570-80328F6E-70523E1AE2997C8D48CAB26A_des|trigger=none|class=sIndent}Returns an array with the primary key values of the record.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:E522D63523A424C6-9D951192-4BAC4570-80328F6E-70523E1AE2997C8D48CAB26A_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:E522D63523A424C6-9D951192-4BAC4570-80328F6E-70523E1AE2997C8D48CAB26A_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:E522D63523A424C6-9D951192-4BAC4570-80328F6E-70523E1AE2997C8D48CAB26A_ret|text=|trigger=button}{sub-section}{sub-section:E522D63523A424C6-9D951192-4BAC4570-80328F6E-70523E1AE2997C8D48CAB26A_ret|trigger=none|class=sIndent}Object[] -- an Array with the pk values.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:E522D63523A424C6-9D951192-4BAC4570-80328F6E-70523E1AE2997C8D48CAB26A_see|text=|trigger=button}{sub-section}{sub-section:E522D63523A424C6-9D951192-4BAC4570-80328F6E-70523E1AE2997C8D48CAB26A_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:E522D63523A424C6-9D951192-4BAC4570-80328F6E-70523E1AE2997C8D48CAB26A_see|text=|trigger=button}{sub-section}{sub-section:E522D63523A424C6-9D951192-4BAC4570-80328F6E-70523E1AE2997C8D48CAB26A_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:E522D63523A424C6-9D951192-4BAC4570-80328F6E-70523E1AE2997C8D48CAB26A_sam|text=|trigger=button}{sub-section}{sub-section:E522D63523A424C6-9D951192-4BAC4570-80328F6E-70523E1AE2997C8D48CAB26A_sam|class=sIndent|trigger=none}{code:language=javascript}
var pks = foundset.getSelectedRecord().getPKs() // also foundset.getRecord can be used
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=90397A392CCA77C3-A671C03E-480F4FFE-924FB44D-247C29D0B4FB46A573F8D104}{tr:id=name}{td}h6.isEditing{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}isEditing{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:90397A392CCA77C3-A671C03E-480F4FFE-924FB44D-247C29D0B4FB46A573F8D104_des|text=|trigger=button}{sub-section}{sub-section:90397A392CCA77C3-A671C03E-480F4FFE-924FB44D-247C29D0B4FB46A573F8D104_des|trigger=none|class=sIndent}Returns true or false if the record is being edited or not.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:90397A392CCA77C3-A671C03E-480F4FFE-924FB44D-247C29D0B4FB46A573F8D104_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:90397A392CCA77C3-A671C03E-480F4FFE-924FB44D-247C29D0B4FB46A573F8D104_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:90397A392CCA77C3-A671C03E-480F4FFE-924FB44D-247C29D0B4FB46A573F8D104_ret|text=|trigger=button}{sub-section}{sub-section:90397A392CCA77C3-A671C03E-480F4FFE-924FB44D-247C29D0B4FB46A573F8D104_ret|trigger=none|class=sIndent}[Boolean] -- a boolean when in edit.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:90397A392CCA77C3-A671C03E-480F4FFE-924FB44D-247C29D0B4FB46A573F8D104_see|text=|trigger=button}{sub-section}{sub-section:90397A392CCA77C3-A671C03E-480F4FFE-924FB44D-247C29D0B4FB46A573F8D104_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:90397A392CCA77C3-A671C03E-480F4FFE-924FB44D-247C29D0B4FB46A573F8D104_see|text=|trigger=button}{sub-section}{sub-section:90397A392CCA77C3-A671C03E-480F4FFE-924FB44D-247C29D0B4FB46A573F8D104_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:90397A392CCA77C3-A671C03E-480F4FFE-924FB44D-247C29D0B4FB46A573F8D104_sam|text=|trigger=button}{sub-section}{sub-section:90397A392CCA77C3-A671C03E-480F4FFE-924FB44D-247C29D0B4FB46A573F8D104_sam|class=sIndent|trigger=none}{code:language=javascript}
var isEditing = foundset.getSelectedRecord().isEditing() // also foundset.getRecord can be used
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=08966F380BF631AC-59E5BAF7-4B7E4E70-B768A409-9FE7C563442A39B92FA116BD}{tr:id=name}{td}h6.rollbackChanges{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}void{span}{span:id=iets|style=float: left; font-weight: bold;}rollbackChanges{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:08966F380BF631AC-59E5BAF7-4B7E4E70-B768A409-9FE7C563442A39B92FA116BD_des|text=|trigger=button}{sub-section}{sub-section:08966F380BF631AC-59E5BAF7-4B7E4E70-B768A409-9FE7C563442A39B92FA116BD_des|trigger=none|class=sIndent}If this record exists in underlying datasource it will do a re-query to fetch the latest data from the datasource.
NOTE: If you use transactions then it will be the data of your last update of this record in the transaction,
not the latest committed data of that record in the datasource.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:08966F380BF631AC-59E5BAF7-4B7E4E70-B768A409-9FE7C563442A39B92FA116BD_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:08966F380BF631AC-59E5BAF7-4B7E4E70-B768A409-9FE7C563442A39B92FA116BD_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:08966F380BF631AC-59E5BAF7-4B7E4E70-B768A409-9FE7C563442A39B92FA116BD_ret|text=|trigger=button}{sub-section}{sub-section:08966F380BF631AC-59E5BAF7-4B7E4E70-B768A409-9FE7C563442A39B92FA116BD_ret|trigger=none|class=sIndent}void{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:08966F380BF631AC-59E5BAF7-4B7E4E70-B768A409-9FE7C563442A39B92FA116BD_see|text=|trigger=button}{sub-section}{sub-section:08966F380BF631AC-59E5BAF7-4B7E4E70-B768A409-9FE7C563442A39B92FA116BD_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:08966F380BF631AC-59E5BAF7-4B7E4E70-B768A409-9FE7C563442A39B92FA116BD_see|text=|trigger=button}{sub-section}{sub-section:08966F380BF631AC-59E5BAF7-4B7E4E70-B768A409-9FE7C563442A39B92FA116BD_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:08966F380BF631AC-59E5BAF7-4B7E4E70-B768A409-9FE7C563442A39B92FA116BD_sam|text=|trigger=button}{sub-section}{sub-section:08966F380BF631AC-59E5BAF7-4B7E4E70-B768A409-9FE7C563442A39B92FA116BD_sam|class=sIndent|trigger=none}{code:language=javascript}
var record= forms.customer.foundset.getSelectedRecord();
record.rollbackChanges();
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}