Docs
ServoyCloudSupportSamplesOpen SourceCommunity
  • Home
  • GUIDES
    • Platform Overview
    • Get Servoy
    • Get Started
      • Chapter 0
      • Chapter 1
      • Chapter 2
      • Chapter 3
      • Chapter 4
      • Chapter 5
    • Get Help
      • SuLA Instructions
      • SuLA Terms
    • Develop
      • Application Design
        • Forms
          • Layout Management
            • Simple Layout
            • Fully Responsive
              • Bootstrap 12-Grid
              • Flexbox
              • Custom Div
              • Collapsible Container
              • Simple Collapsible
              • Center Container
              • Inline Group Container
            • Abstract Form
          • Form Containers
            • Form Container
            • Tab Panel
            • Split Pane
            • Collapse
            • Accordion Panel
            • Form Component
            • List Form Component
          • Form Inheritance
          • Form Components
        • UI Components
          • Buttons and Text
            • Badge
            • Button
            • Data Label
            • Dropdown
            • Image
            • Label
          • Grids
            • Data Grid
            • Power Grid
            • Table
          • Input Controls
            • Calendar
            • Calendar Inline
            • Checkbox
            • Choice Group
            • Combobox
            • Group Buttons
            • Html Area
            • Input Group
            • Rating
            • Slider
            • Switch
            • Spinner
            • TextArea
            • Textbox
            • TextBoxGroup
            • Type Ahead
            • select2tokenizer
          • Media
            • Carousel
            • Embedded YouTube
            • File upload
            • Image label
            • Lightbox Gallery
            • MultiFile Upload
            • PDF JS Viewer
            • PDF Viewer
          • Mobile
            • Native Data List
            • Native Select
          • Navigation
            • Breadcrumbs
            • Navbar
            • sidenav
          • Visualization
            • DBTreeview
            • Progress Bar
            • Treeview
            • ChartJS
              • Data Labels Plugin
              • Funnel Chart
              • OutLabels Plugin
              • TreeMap
          • Specialized Components
            • Smart Document Editor
            • Servoy PDF Viewer
            • Fullcalendar Component
              • Fullcalendar
              • Fullcalendar Events
              • Migrating calendar from Smart and Web client to NG client
            • Fullcalendar Component 2
            • Canvas
            • Google Charts
            • Google Maps
            • svySignature
            • svywebcam
        • Styling and Themes
          • Default Theme Properties
          • CSS / LESS
          • Component Variants
          • Font Icons
        • Data Modeling
          • Databases
            • Tables
              • Columns
              • Calculations
              • Aggregations
              • Methods
              • Events / Triggers
              • Table security
            • Views
            • Procedures
          • Relations
          • Value Lists
          • Menus
          • In-Memory Databases
          • View Datasource
        • Modular Design
      • Programming Guide
        • Scripting the UI
          • Scripting Forms
          • Interacting with Components
          • Navigation
          • Windows, Dialogs and Popups
          • Events Manager
        • Working with Data
          • Concepts
          • Loading
          • Sorting
          • Iterating
          • Searching
            • Find mode
            • Query Builder
            • SQL String
          • Filtering
          • Editing
          • Validation
        • Automation and Scheduling
          • Batch Processor
          • Headless API
          • Scheduler API
        • Creating REST APIs
        • Consuming Webservices
        • Working with Files
          • File Plugin Basics
          • Images
          • Excel
          • PDF
          • JSON
        • Browser Utilities
          • Notifications
            • Web Notifications (Toastr)
            • Web Notifications (Native)
            • Block UI
          • Session Management
          • Keyboard Utilities
          • NG Utils
        • Sending and Receiving Email
        • Servoy Jasper Reports
          • Input Type
          • Display Mode
          • Output format
          • Jaspe Reports Viewer
        • Extensions
          • Modules
            • svyPhonegap
              • First Use Guide
              • Barcode Scanner
              • Browser
              • Camera
              • File
              • Fingerprint
              • Location
              • Network Interface
              • Phonegap
              • Printer
              • Push Notifications
            • svyAPI
              • Getting Started
            • svyLookup
              • Custom Templates
              • API Documentation
              • svyLookup v1
                • API Documentation v1.0.0
                • Base Form svyLookupTable v1.0.0
                • Base Form AbstractLookup v1.0.0
            • svyNavigation
              • API Documentation
                • API svyNavigation
                • API svyNavigationHistory
                • API svyNavigationUX
            • svyPopupFilter
              • Simple Filter Pickers
              • Custom Templates
              • API Documentation
                • API svyToolbarFilter
                • API svyPopupFilter
              • API Documentation v1
                • API svyToolbarFilter v1
                • API svyPopupFilter v1
            • svySearch
            • svySecurity
              • Overview
              • Token-based Auth and SSO (NEW!)
              • API Documentation
              • Getting Started
              • Tenant replication
              • Security Management Console
                • Classic Security Management Console
              • svySecurityUX
              • svyProperties
              • API Doc svyProperties
            • svyUtils
              • Log Manager
              • Log Manager Appenders
              • Smart Doc Editor Utils
              • Custom Dialogs
              • Excel Utils
                • Full API Reference
              • Crypto Utils
      • Security
        • Authentication
        • Permissions
          • UI Permissions
          • Data Permissions
          • Runtime Permissions
        • Audit Logging
        • OAuth
        • JWT
      • Multi-Language Support
      • Mobile Development
        • Getting Started
        • Mobile Design
        • Native Mobile Integrations
        • Building a Native Binary for the App Store
      • Native Desktop Development
        • NGDesktop UI plugin
        • NGDesktop Utils
        • NGDesktop File Plugin
    • Deploy
      • WAR Deployment
      • Docker Deployment
      • Server Configuration
        • Server Settings
        • Server Plugins
        • Database Servers
          • Locks
          • Transactions
          • Oracle
          • SQLServer
        • Client Sessions
        • Batch Processors
        • License Management
        • Monitoring
          • Server Log
          • Browser Console Log
          • Websocket Log
          • Query Performance
          • Client Performance
          • Client Event Tracing
          • Monitoring Servoy with JMX
      • NGClient deployment
      • Troubleshooting
      • Other Topics
        • Security: Cross-site Scripting
        • Running in an iFrame
    • Extend
    • Contribute
  • Reference
    • Servoy Core
      • Object Model
        • Database Server
          • Table
            • Column
            • Calculation
            • Method
            • Aggregation
          • View
          • Procedure
        • Solution
          • Form
          • Form Component
          • Relation
          • Relation Item
          • Table Node
          • Value List
          • Menu
          • Menu item
          • In-Memory Data Source
          • View Foundset Data Source
          • Variable
          • Column Info
          • Media
          • Layout Container
          • Method
        • i18n Message Key
      • Developer API
        • Globals
        • Forms
          • RuntimeForm
            • controller
            • containers
              • RuntimeContainer
            • elements
              • Component
              • RuntimeAccordionPanel
              • RuntimeBean
              • RuntimeButton
              • RuntimeCalendar
              • RuntimeCheck
              • RuntimeCombobox
              • RuntimeComponent
              • RuntimeDataButton
              • RuntimeDataLabel
              • RuntimeGroup
              • RuntimeHtmlArea
              • RuntimeImageMedia
              • RuntimeInsetList
              • RuntimeLabel
              • RuntimeListBox
              • RuntimePassword
              • RuntimePortal
              • RuntimeRadio
              • RuntimeChecks
              • RuntimeRadios
              • RuntimeRectangle
              • RuntimeRtfArea
              • RuntimeSpinner
              • RuntimeSplitPane
              • RuntimeTabPanel
              • RuntimeTextArea
              • RuntimeTextField
              • RuntimeWebComponent
        • JS Lib
          • Array
          • BigInt
          • Boolean
          • Date
          • Function
          • IterableValue
          • Iterator
          • JSON
          • Map
          • Set
          • Math
          • Namespace
          • Number
          • Object
          • Promise
          • QName
          • RegExp
          • Special Operators
          • Statements
          • String
          • XML
          • XMLList
        • Application
          • APPLICATION_TYPES
          • CLIENTDESIGN
          • DRAGNDROP
          • ELEMENT_TYPES
          • LOGGINGLEVEL
          • NGCONSTANTS
          • UICONSTANTS
          • CSSPosition
          • JSDimension
          • JSDNDEvent
          • JSEvent
          • JSLogger
          • JSLogBuilder
          • JSPoint
          • JSUpload
          • JSWindow
          • JSBounds
          • Renderable
          • UUID
        • SolutionModel
          • ALIGNMENT
          • ANCHOR
          • BEVELTYPE
          • CURSOR
          • DEFAULTS
          • FONTSTYLE
          • MEDIAOPTION
          • PAGEORIENTATION
          • PRINTSLIDING
          • SCROLLBAR
          • TITLEJUSTIFICATION
          • TITLEPOSITION
          • UNITS
          • JSBean
          • JSButton
          • JSCalculation
          • JSComponent
          • JSDataSourceNode
          • JSField
          • JSForm
          • JSLabel
          • JSMedia
          • JSMethod
          • JSPart
          • JSPortal
          • JSRelation
          • JSRelationItem
          • JSStyle
          • JSTab
          • JSTabPanel
          • JSValueList
          • JSVariable
          • JSTitle
          • JSChecks
          • JSCombobox
          • JSHeader
          • JSInsetList
          • JSList
          • JSPassword
          • JSRadios
          • JSText
          • JSTextArea
          • JSWebComponent
          • JSLayoutContainer
        • Database Manager
          • QUERY_COLUMN_TYPES
          • SQL_ACTION_TYPES
          • JSColumn
          • JSDataSet
          • JSBaseRecord
          • JSBaseSqlRecord
          • JSBaseFoundset
          • JSBaseSQLFoundset
          • JSFoundSet
          • JSFoundSetUpdater
          • JSRecord
          • JSRecordMarker
          • JSRecordMarkers
          • JSTable
          • JSTableFilter
          • MenuFoundSet
          • MenuItemRecord
          • QBAggregate
          • QBAggregates
          • QBCase
          • QBCaseWhen
          • QBColumn
          • QBColumns
          • QBCondition
          • QBFunction
          • QBFunctions
          • QBGroupBy
          • QBJoin
          • QBJoins
          • QBLogicalCondition
          • QBParameter
          • QBParameters
          • QBPart
          • QBResult
          • QBSearchedCaseExpression
          • QBSelect
          • QBSort
          • QBSorts
          • QBTableClause
          • QBWhereCondition
          • ViewFoundSet
          • ViewRecord
        • Events Manager
          • EVENTS_AGGREGATION_TYPES
          • EventType
        • Menus
          • JSMenu
          • JSMenuItem
        • JSMenuDatasource
        • Utils
        • Client Utils
          • JSBlobLoaderBuilder
        • History
        • Security
        • i18n
        • ServoyException
          • DataException
        • JSUnit
        • Datasources
          • DBDataSource
          • DBDataSourceServer
          • JSConnectionDefinition
          • JSDataSource
          • MemDataSource
          • MenuDataSource
          • SPDataSource
          • SPDataSourceServer
          • ViewDataSource
        • JSViewDatasource
        • servoyDeveloper
        • enum
    • Extensions
      • UI Components
        • Buttons and Text
          • Badge
          • Button
          • Data Label
          • Drop Down
          • Image
          • Label
        • Form Containers
          • Accordion Panel
          • Collapse
          • Form Container
          • Form Component Container
          • List Form Component
          • Default Loading Indicator
          • Error Bean
          • Portal
          • Responsive Container
          • Servoy Default Navigator
          • Slider
          • Split Pane
          • TabPanel
        • Grids
          • Data Grid
          • Power Grid
          • Table
        • Input Controls
          • Calendar
          • Calendar Inline
          • Checkbox
          • Choice Group
          • Combobox
          • Floatinglabel Calendar
          • Floatinglabel Combobox
          • Floatinglabel Textarea
          • Floatinglabel Textbox
          • Floatinglabel Type Ahead
          • Group Buttons
          • Html Area
          • Input Group
          • Rating
          • Select2tokenizer
          • Slider
          • Spinner
          • Switch
          • TextArea
          • TextBox
          • TextBox Group
          • Type Ahead
        • Media
          • Carousel
          • Embedded YouTube
          • File upload
          • Image label
          • Lightbox Gallery
          • MultiFile Upload
          • PDF JS Viewer
          • PDF Viewer
        • Mobile
          • Native Data List
          • Native Select
        • Navigation
          • Breadcrumbs
          • Navbar
          • sidenav
        • SmartDocEditor
          • Smart Document Editor
        • Visualization
          • Canvas
          • Chart
          • Custom List
          • DBTreeview
          • Foundset List
          • Fullcalendar
          • Gauge
          • Google Maps
          • Kanban
          • Progress Bar
          • Treeview
      • Server Plugins
        • amortization
          • AmortizationCalculation
          • Polynomial
        • clientmanager
          • Broadcaster
          • JSClientInformation (cm)
        • excelxport
        • file
          • JSFile
          • JSProgressMonitor
        • headlessclient
          • JSClient
        • http
          • HTTP_STATUS
          • Cookie
          • DeleteRequest
          • GetRequest
          • HeadRequest
          • HttpClient
          • HttpClientConfig
          • OptionsRequest
          • PostRequest
          • PutRequest
          • Response
          • TraceRequest
          • PatchRequest
          • JSFileUpload
        • images
          • JSImage
        • jwt
          • Algorithm
          • Builder
          • JWTClaims
        • mail
          • Attachment
          • MailMessage
        • maintenance
          • JSClientInformation
          • JSColumnObject
          • JSServer
          • JSTableObject
        • mobileservice
          • OfflineDataDescription
        • oauth
          • ClientAuthentication
          • CustomApiBuilder
          • OAuthProviders
          • OAuthRequest
          • OAuthResponse
          • OAuthResponseBinary
          • OAuthResponseJSON
          • OAuthResponseText
          • OAuthService
          • OAuthServiceBuilder
          • OAuthTokenExtractors
          • RequestType
        • pdf_output
        • rawSQL
        • RestWs plugin
        • rest_ws
          • WsContents
          • WsCookie
          • WsRequest
          • WsResponse
        • scheduler
        • serialize
        • textxport
          • DataProviderExport
          • TabExporter
        • udp
          • JSPacket
        • XmlReader
          • XmlNode
      • Browser Plugins
        • Block UI
        • Block UI (ref)
        • Dialogs Plugin
        • Idle
        • Idle (ref)
        • Key Listener
        • Key Listener (ref)
        • NGDesktop File
        • NGDesktop File (ref)
        • NGDesktop UI (ref)
        • NGDesktop Utils (ref)
        • NG Utils (ref)
        • Office Javascript API for Servoy
        • Phonegap
        • Web Notifications (Native)
        • Web Notifications (Toastr)
        • Window Plugin
        • Font Awesome
      • Modules
        • Smart Doc Editor Utils
        • svyAPI
          • Getting Started
        • svyLookup
          • Custom Templates
          • API Documentation
          • svyLookup v1
            • API Documentation v1.0.0
            • Base Form svyLookupTable v1.0.0
            • Base Form AbstractLookup v1.0.0
        • svyLookupExample
        • svyNavigation
          • API Documentation
            • API svyNavigation
            • API svyNavigationHistory
            • API svyNavigationUX
        • svyNavigationUX
        • svyNavigationUXSample
        • svyPopupFilter
          • Simple Filter Pickers
          • Custom Templates
          • API Documentation
            • API svyToolbarFilter
            • API svyPopupFilter
          • API Documentation v1
            • API svyToolbarFilter v1
            • API svyPopupFilter v1
        • svyProperties
        • svySearch
        • svySecurity
          • Overview
          • Token-based Auth and SSO (NEW!)
          • API Documentation
          • Getting Started
          • Tenant replication
          • Security Management Console
            • Classic Security Management Console
          • svySecurityUX
          • svyProperties
          • API Doc svyProperties
        • svySecurityConsole
        • svySecurityUX
        • svyUtils
          • Log Manager
          • Log Manager Appenders
          • Smart Doc Editor Utils
          • Custom Dialogs
          • Excel Utils
          • Full API Reference
          • Crypto Utils
        • svyUtils$Excel
        • svyUtils$NGClient
        • svyUtils$customDialogs
        • svyUtils$logManagerAppenders
        • svyUtils$tableGrid
      • Layout
        • Boostrap 12grid layout
          • Collapsible Container
          • Simple Collapsible
          • Center Container
          • Inline Group Container
          • Flexbox Layout
      • Solutions
        • Sample Application
          • Tutorial Part 1
          • Tutorial Part 2
      • Packages
        • UI Component Packages
          • Advanced Renderers
          • Bootstrap Components
          • Bootstrap Extra Components
          • Canvas
          • Chart JS
          • Fullcalendar Component
          • googlemaps
          • kanban
          • Servoy Core
          • Servoy Extra Components
          • Servoy NG-Grids
          • Servoy PDF Viewer
          • smartDocumentEditor
        • Browser Plugin Packages
          • Block UI
          • Core NG only Services
          • Key Listener
          • NGDesktop File
          • NGDesktop UI
          • NGDesktop Utils
          • Web Notifications
          • Idle Web Service
    • Servoy Developer
      • Menu
        • File
        • Edit
        • Source
        • Refactor
        • Navigate
        • Search
        • Project
        • Actions
        • Run
        • Window
        • Help
      • Toolbar
      • Solution Explorer
        • Resources
          • Database Servers
            • Database Server
              • Procedures
              • Tables
              • Views
          • Security
          • i18n
        • All Solutions
          • Solution
          • Active Solution
            • Scopes
              • Scope
                • Variables
            • Forms
              • Working Set
              • Form
                • Controller
                • Variables
                • Elements
                • Relations
            • Form Components
              • Form Component
            • Relations
              • Relation
            • ValueLists
              • ValueList
            • Menus
              • Menu
                • MenuItem
            • Media
              • Folder
              • File
            • DataSources
              • In Memory DataSources
                • In Memory DataSource
              • View Foundsets DataSources
                • View Foundset DataSources
            • Servoy Packages
              • Package
            • Modules
              • Module
        • Solution Explorer Contextual List
      • Views
        • Command Console
        • Console
        • Problems
        • Tasks
        • Bookmarks
        • Search
        • Form Hierarchy
        • Help
        • JUnit
        • Outline
        • Profiler
        • Properties
        • Project Explorer
        • Call Hierarchy
      • Editors and Wizards
        • Property configurator for columns
        • Relation Editor
        • Text Format Editor
        • Date Format Editor
        • Number Format Editor
        • Database Synchronization Wizard
        • Security Editor
        • SQL Editor
        • i18n Editor
        • File Import Wizard
        • File Export Wizard
        • WAR Export Wizard
        • NGDesktop Export Wizard
        • Table Editor
        • Metadata Synchronization Wizard
        • Database Server Connection Editor
        • Text Property Editor
        • Valuelist Editor
        • Form Editor
          • Parts of the Form Editor
          • Designing a Form
          • Layout Tools
          • Using Containers
          • Creating and Using Forms
          • Using Servoy Beans
          • Using Shapes
          • Form Editor Subtabs
          • [Tips and Shortcuts][reference/servoy-developer/object-editors/form-editor-tips_and_shortcuts.md]
          • Editong a Responsive LayoutForm
          • CSS Positioning
        • Form Hierarchy
        • Component Properties Editor
        • Variable Editor
        • Method Selection Wizard
        • New Solution Wizard
        • Application Event Types Editor
        • New Form Wizard
        • Form Dataproviders Configurator
        • Servoy Resource Locator
        • Datasource Selection Wizard
        • Sorting Fields Wizard
        • Scripting Editor
          • Getting Started-Overview of Script Editor
          • Code Writing Features
          • Code Navigation
          • Code Rewriting Tools
          • Refactoring
          • Code Formatting
          • Script Editor Tips and Shortcuts
          • Unit Tests
        • Theme Editor
          • General Properties
          • Sidenav Properties
          • Navbar Properties
          • Tabs Properties
          • Windows Properties
          • Dialogs Properties
          • Tables Properties
          • Breadcrumb specific style Properties
          • Brand colors Properties
          • Validations Properties
          • Margins and Padding Properties
        • Editor Selection
        • Run Configurations
        • Debug Configurations
        • Externalize Strings Wizard
        • Font Chooser Wizard
        • Color Chooser Wizard
        • Project Properties Configurator
        • Move Wizard
        • External Tools Configurations
        • About Servoy Developer
        • Servoy Developer Installation Details
        • Eclipse Marketplace Wizard
        • Install Available Software Wizard
        • Cheat Sheet Selection Wizard
        • Servoy Developer Help Wizard
        • Switch to Editor Wizard
        • Find Actions Wizard
        • Customize Perspective Configurator
        • Quick Search Wizard
        • Search Wizard
        • Encoding Wizard
        • Task Wizard
        • Find - Replace Wizard
        • Properties Editor
        • New Project Wizard
        • New Method Wizard
        • New Menu Wizard
          • New MenuItem Wizard
        • Menu Editor
        • ServoyMenu Selection Wizard
        • JSMenu compatible component selector
        • Permissions Configuration Dialog
      • Project File Structure
        • Servoy Installation Directory
          • servoy.properties
        • Workspace Folder
          • Resources Directory
            • Database Information (.dbi) Files
          • Solution Folder
      • Package Manager
      • Preferences
      • Property Types for components / services
      • Debugger
        • Debug Explorer
        • Breakpoints
          • Breakpoint Properties
        • Variables
        • Expressions
        • Interactive Console
    • Application Server
    • Servoy Cloud
      • Cloud Control Center
        • Home
          • Setup Namespace
          • User profile
            • My Profile
            • Support
        • Download IDE
        • Application Overview
          • Applications
            • Pipelines
              • Jobs
                • Packages
                  • Commits
                  • Artifacts
                  • Configuration
                  • Quality reports
                  • Build markers
                • Job Configuration
                  • Build and Deploy or Build
                  • Mobile
                  • Desktop
            • Environments
              • Metrics
                • Users
                • Databases
                  • Metrics
                • System Health
                • Log Activity
                • App performance
                • Query performance
              • Cloud reporting
            • Security
              • Permissions
              • Tenants
            • Reports
            • Security Login Designer
              • Single Sign-On
                • Sign in with Google
                • Sign in with Microsoft
          • Code Repositories
        • Project Management
          • Tickets
          • Backlog
          • Active Sprints
        • User Management
          • Users
          • Roles
        • Administration
          • Security
            • ServoyCloud Roles
          • Credentials
          • Settings
        • Add-Ons
      • Database Backup
      • E2E Cypress Testing
        • Using Cypress
      • On-Premise Deployment
      • Privacy policy (ServoyAI)
      • FAQ
      • Migrate to Servoy Cloud
    • Extensions Developement
      • Component and Services
        • Component Development
        • Service Development
        • Tools and Dev Tips to use for Component/Service developement
        • Manifest (.mf file)
        • Specification (.spec file)
          • Property Types
            • Array property types
            • Custom object property types
            • Findmode property type
            • Foundset property type
            • Tags
        • Directives And Filters
          • Sablotabsequence
        • Console (serverside)
        • ServoyApi (serverside)
      • Serverside Plugins
        • Data Convertors and Validators
        • UI Convertors
  • Release notes
    • Release notes
      • 2025.03
      • 2024.03 (LTS)
      • 2023.03 (LTS)
      • 2025.03 (Servoy Cloud)
      • 2024.12
      • 2024.12 (Servoy Cloud)
      • 2024.09
      • 2024.09 (Servoy Cloud)
      • 2024.06
      • 2024.06 (Servoy Cloud)
      • 2024.03 (Servoy Cloud)
      • 2023.12
      • 2023.12 (Servoy Cloud)
      • 2023.09
      • 2023.09 (Servoy Cloud)
      • 2023.06
      • 2022.03 (LTS)
      • 2022.12 What's new
      • 2022.12
      • 2022.09 What's new
      • 2022.09
      • 2022.06 What's new
      • 2022.06
      • 2021.03.3 (LTS)
Powered by GitBook
On this page
  • Overview
  • Creating Records
  • Editing Records
  • Direct Assignment
  • Batch Editing Using Foundset Updater
  • Deleting Records
  • Single Record Deletion
  • Deleting All Records in a Foundset
  • Reverting Deletions
  • Auto Save: True vs. False
  • Auto Save: True
  • Auto Save: False
  • Retrieving Changes
  • Save Edited Records
  • Saving a Single Record
  • Saving an Entire Foundset
  • Saving All Edited Records in the Session
  • Handling Failed Records
  • Get Failed Records
  • Processing Exceptions in Failed Records
  • Using Transactions
  • Reverting Changes
  • Revert Single Record
  • Revert Foundset Changes
  • Revert Related Foundset Changes
  • Revert All Changes
  • Related Articles
  • Validation
  • Auto-enter
  • Table Events

Was this helpful?

  1. GUIDES
  2. Develop
  3. Programming Guide
  4. Working with Data

Editing

PreviousFilteringNextValidation

Last updated 8 months ago

Was this helpful?

Overview

Servoy's data editing capabilities allow developers to create, modify, and delete records with precision and control. These operations are essential for managing dynamic data in real-time applications. Servoy’s framework supports transactional operations, which means that developers can ensure data consistency and integrity across various complex workflows.

Creating Records

Creating a record in Servoy is straightforward with the method. This method initiates a new, empty record that can be populated with data before being saved to the database.

Example

The createRecord() method is commonly used in forms where users input new data, such as adding a new order in an e-commerce system. The example shows a new order being created with a date, a customer ID, and an initial status of pending. In an inventory system, when new stock arrives, the warehouse staff uses a form to add the new inventory items to the database. The createRecord() method allows the system to generate a new entry for each item efficiently.

var newOrder = ordersFoundset.createRecord();
newOrder.order_date = new Date();
newOrder.customer_id = 123;
newOrder.status = 'pending';

Other methods for creating a record:

Editing Records

Direct Assignment

Once a record is retrieved or created, its fields can be modified by assigning new values directly to the record’s columns.

Example

This approach is the most straightforward for modifying existing records. It is particularly useful when making changes to a single record that is currently selected in a form, such as updating an order’s status when it has been shipped. In a customer service application, when a representative updates a customer’s details, such as changing their address or phone number, direct assignment is used to modify the customer record.


var order = ordersFoundset.getSelectedRecord();
order.status = 'shipped';
order.shipping_date = new Date();

Batch Editing Using Foundset Updater

Example

This example demonstrates how to update the status of all orders placed before January 1, 2020, to "archived." The JSFoundsetUpdater is more efficient than looping through records individually, especially for large datasets. A common scenario is end-of-year processing, where orders older than a certain date need to be archived. This approach ensures that all relevant records are updated in a single operation, reducing the risk of errors and improving performance.

var updater = databaseManager.getFoundSetUpdater(ordersFoundset);
updater.setColumn('status', 'archived');
updater.addCondition('order_date', '<', new Date('2020-01-01'));
updater.performUpdate();

Deleting Records

Single Record Deletion

Example

When a user wishes to remove an outdated or incorrect entry, such as a customer who is no longer active, they can delete the record directly from the system.

var customer = customersFoundset.getSelectedRecord();
customersFoundset.deleteRecord(customer);

Other methods for deleting a record:

Deleting All Records in a Foundset

Example

During testing, developers might populate the system with test orders, which can be easily removed in bulk using this method once testing is complete.

ordersFoundset.deleteAllRecords();

Reverting Deletions

Example

In a financial application, transactions might be deleted in error. By disabling autosave, the deletion can be rolled back if the user realizes the mistake before committing.

databaseManager.setAutoSave(false);
ordersFoundset.deleteRecord(order);
// Review deletion
databaseManager.rollbackTransaction(); // Reverts the deletion

Auto Save: True vs. False

Auto Save: True

This mode commits changes automatically, making it suitable for applications where data consistency is required immediately after user actions.

Why Use Auto Save: True

  • Real-Time Data Consistency: Auto Save set to true is ideal for applications where data needs to be immediately reflected in the database, such as in transaction-heavy environments like retail systems or real-time monitoring applications.

  • Simplicity: This setting reduces the need for manual saves, ensuring that data is always up-to-date without requiring additional steps from the user.

Example

In retail point-of-sale (POS) systems, each transaction must be recorded as soon as it occurs. Autosave ensures that every sale is immediately reflected in the inventory and sales records.

Auto Save: False

This setting allows for greater control, enabling developers to decide when to commit changes. It’s ideal for complex workflows where multiple related changes need to be committed simultaneously.

Why Use Auto Save: False

  • Greater Control: Setting Auto Save to False is advantageous in scenarios where multiple related changes need to be made and reviewed together before saving. This approach is commonly used in applications where data integrity is critical, such as financial systems or multi-step data entry processes.

  • Error Handling: By delaying the commit of data changes, developers can implement validation, error checking, and transaction management, reducing the risk of incomplete or incorrect data being saved.

Currently delete is immediate when Auto Save is set to false.

Example

This example shows how autosave can be turned off to allow for multiple related changes to be made before committing them. It’s especially useful in scenarios where partial data should not be saved. In an order entry system, users may need to input multiple details across different tables before saving the entire transaction. Autosave can be disabled to ensure the transaction is only saved when all details are correct.

// Disable Auto Save
databaseManager.setAutoSave(false);

// Perform data operations
var product = productsFoundset.createRecord();
product.name = 'New Product';
product.price = 19.99;

// Save changes at once
databaseManager.saveData();

Retrieving Changes

Example

In a CRM system, changes to customer records might need to be reviewed or approved by a manager before being finalized. This method allows for such review processes to be implemented.

var changes = order.getChangedData();
for (var field in changes) {
    application.output('Field ' + field + ' changed to: ' + changes[field]);
}

Save Edited Records

When saving edited records in Servoy, it's important to understand that if the save operation fails, it will not throw an exception. Instead, the saveData() method will return false. It is the developer's responsibility to check whether the save was successful and handle any potential issues, including parsing exceptions from failed records.

Saving a Single Record

Example

In a customer management system, a user edits a single customer's details, such as updating their phone number or address. Before committing this change, it's essential to verify that the update is successful, especially if the record must meet specific validation criteria, such as unique email addresses. If the save fails, the user can be alerted, and the failure can be logged for further analysis.

var success = databaseManager.saveData(record);
if (!success) {
    var failedRecords = databaseManager.getFailedRecords();
    for (var i = 0; i < failedRecords.length; i++) {
        var failedRecord = failedRecords[i];
        application.output('Failed to save record with ID: ' + failedRecord.getPKs() + ' Error: ' + failedRecord.exception.getMessage());
    }
}

Saving an Entire Foundset

Example

In an order management system, an administrator may batch update the status of several orders in a foundset (e.g., marking them all as shipped). It’s critical to ensure that all records are successfully saved to prevent inconsistencies in order processing. If any record fails to save, the operation should be logged, and corrective actions should be taken, such as retrying the save or notifying the administrator.

var success = databaseManager.saveData(foundset);
if (!success) {
    var failedRecords = databaseManager.getFailedRecords();
    for (var i = 0; i < failedRecords.length; i++) {
        var failedRecord = failedRecords[i];
        application.output('Failed to save record in foundset with ID: ' + failedRecord.getPKs() + ' Error: ' + failedRecord.exception.getMessage());
    }
}

Saving All Edited Records in the Session

Example

In a data entry application where multiple records across different foundsets are edited during a session, it's crucial to save all changes before the session ends. This ensures data consistency across the application. If the global save operation fails, the developer can handle the situation by identifying which records failed and implementing a rollback or providing the user with an opportunity to correct the errors before retrying the save.

var success = databaseManager.saveData();
if (!success) {
    var failedRecords = databaseManager.getFailedRecords();
    for (var i = 0; i < failedRecords.length; i++) {
        var failedRecord = failedRecords[i];
        application.output('Failed to save record with ID: ' + failedRecord.getPKs() + ' Error: ' + failedRecord.exception.getMessage());
    }
}

Handling Failed Records

When saving data in Servoy, it’s essential to manage failed records to maintain data integrity.

Get Failed Records

Example

In an e-commerce application, after bulk updating product information, some records fail to save due to validation errors, such as duplicate SKUs or missing mandatory fields.

var failedRecords = databaseManager.getFailedRecords();
for (var i = 0; i < failedRecords.length; i++) {
    var failedRecord = failedRecords[i];
    application.output('Failed to save record with ID: ' + failedRecord.getPKs());
}

Processing Exceptions in Failed Records

Example

In a financial application, when processing transactions, some records fail to save due to database constraints, such as violating foreign key constraints or exceeding the maximum allowed value for a numeric field.

var failedRecords = databaseManager.getFailedRecords();
for (var i = 0; i < failedRecords.length; i++) {
    var failedRecord = failedRecords[i];
    if (failedRecord.exception) {
        application.output('Failed to save record with ID: ' + failedRecord.getPKs() + ' Error: ' + failedRecord.exception.getMessage());
    } else {
        application.output('Failed to save record with ID: ' + failedRecord.getPKs() + ' with no specific error provided.');
    }
}

Using Transactions

Transactions allow you to bundle multiple database operations together. If any operation fails, the entire transaction can be rolled back, ensuring data consistency.

Example

Considering a financial application where multiple records representing transactions are being processed together, such as transferring funds between accounts. It's critical that either all transactions are successfully processed and committed, or none at all, to maintain financial accuracy and prevent discrepancies. This example represents a typical use case in a financial application where funds are transferred between two accounts. The process involves two critical operations:

  • Debiting $500 from the source account.

  • Crediting $500 to the destination account. Both operations must succeed together to maintain the integrity of the transaction. If any part of the operation fails (e.g., the debit succeeds but the credit fails), the entire transaction is rolled back to prevent inconsistencies, such as money being debited from one account without being credited to another. Detailed error messages are logged if either the save or commit operation fails, and the transaction is rolled back to maintain financial accuracy.

// Start the transaction for processing financial transfers
databaseManager.startTransaction();

try {
    // Create and save the first transaction (debit from source account)
    var debitTransaction = sourceAccountFoundset.getRecord(sourceAccountFoundset.newRecord());
    debitTransaction.amount = -500; // Debit $500 from the source account
    debitTransaction.description = 'Transfer to Account B';

    // Create and save the second transaction (credit to destination account)
    var creditTransaction = destinationAccountFoundset.getRecord(destinationAccountFoundset.newRecord());
    creditTransaction.amount = 500; // Credit $500 to the destination account
    creditTransaction.description = 'Transfer from Account A';

    // Attempt to save both transactions
    if (!databaseManager.saveData()) {
        throw new Error('Failed to save transaction records.');
    }

    // Commit the transaction to ensure both operations are applied
    if (!databaseManager.commitTransaction()) {
        throw new Error('Failed to commit database transaction.');
    }

    // If successful, log the completion of the transfer
    application.output('Transaction committed successfully.');

} catch (e) {
    // Log error and rollback transaction if something fails
    application.output(utils.stringFormat('Transaction failed: "%1$s". Rolling back database transaction.', [e.message]), LOGGINGLEVEL.ERROR);
    databaseManager.rollbackTransaction();
}

Explanation:

  • Saving Data: databaseManager.saveData() is called to save the changes. If the save fails, an error is thrown using throw new Error('Failed to save records.');.

  • Error Handling:

    • The catch block catches any errors thrown during the save or commit operations.

    • The error message is formatted and output using application.output() with a logging level of LOGGINGLEVEL.ERROR.

Reverting Changes

Revert Single Record

Example

A user might change their mind about editing a customer’s details in a CRM system. Using revertChanges() allows them to undo the edits before saving, maintaining the original data.

record.revertChanges();

Revert Foundset Changes

Example

After bulk updating several orders in an e-commerce system, the administrator might realize an error and decide to roll back all changes. This method facilitates that process.

databaseManager.revertEditedRecords(ordersFoundset);

Revert Related Foundset Changes

Example

databaseManager.revertEditedRecords(customer.customers_to_orders);

Revert All Changes

Example

In a data entry application, after a session of input, a user might choose to discard all changes if they realize there were fundamental errors in the data entry process.

databaseManager.revertEditedRecords();

Related Articles

Validation

Before saving data, validation ensures that the data conforms to required formats, ranges, and rules, preventing invalid data from being saved. You can find here more information about validation.

Auto-enter

Table Events

The JSFoundsetUpdater is a powerful tool for applying the same update to multiple records simultaneously, without iterating through each record, using the method.

Deleting a specific record from a foundset involves selecting the record and calling the method. Deleting a record is as simple as selecting it and invoking the deleteRecord() method. This operation removes the record from both the foundset and the database, ensuring it no longer appears in queries or searches.

This method is useful for clearing a foundset completely, such as when resetting a dataset or removing test data. This approach is more drastic and should be used with caution, as it removes all records in the foundset using the method. It's ideal for scenarios where bulk deletion is necessary, such as clearing out temporary data.

By setting autosave to false, any changes, including deletions, can be reviewed and before being committed to the database. This feature is particularly useful in systems where changes need to be reviewed before finalization, such as in draft mode editing where users can preview changes before saving.

The feature in Servoy controls how and when changes to data are committed to the database. By default, Auto Save is set to true, meaning any changes made to records are automatically saved as users interact with the application. This ensures that data is always current and reduces the risk of losing changes. However, in more complex scenarios, setting Auto Save to false provides developers with greater control, allowing changes to be reviewed, batched, or discarded before committing them to the database.

The method provides a way to review the changes made to a record before they are saved. This method is particularly useful for logging or auditing purposes, allowing developers to track what changes have been made to a record before they are committed to the database.

Saving a single record is often used when a user edits or creates a single data entry, such as updating customer information or adding a new product. This approach ensures that the specific record is saved to the database, and if the operation fails, it allows developers to handle the failure by checking for errors and providing feedback or corrective actions. Method:

This method is used when multiple records within a foundset need to be saved simultaneously, such as updating the status of all orders in a list or marking a batch of tasks as completed. Saving an entire foundset ensures that all records within the set are committed to the database in one operation. Developers must verify the save operation’s success to ensure data consistency across the application. Method:

Saving all edited records in the current session is useful in scenarios where multiple foundsets and records have been modified, such as during a data entry session or after making extensive changes across the application. This global save operation commits all pending changes to the database. Developers should check the success of this operation to ensure that all modifications are correctly saved, providing an opportunity to handle any errors across the session’s changes. Method:

The method retrieves an array of records that failed to save during the last saveData() operation. This allows developers to identify and handle problematic records, ensuring data integrity by addressing issues such as validation errors or database constraints that prevented the save.

Each record that fails to save may have an associated exception detailing why the save failed. The property allows developers to access these details, enabling them to log specific error messages, notify users of issues, and take corrective actions. This ensures that errors are not only identified but also addressed in a meaningful way, improving application reliability.

Starting the Transaction: initiates a new transaction. All subsequent operations will be part of this transaction.

Committing the Transaction: If the data is saved successfully, is called to commit the transaction. If this fails, another error is thrown using throw new Error('Failed to commit database transaction.');.

The transaction is then rolled back using , ensuring that no partial changes are committed if something goes wrong.

Use the method to undo modifications to a specific record before they are saved. This method is useful for undoing accidental changes to a record. It can be used in scenarios where the user edits a record but decides not to save the changes.

This method reverts all changes across a foundset, which can be particularly useful when batch changes have been made but need to be discarded. Useful in scenarios where batch edits need to be reviewed and potentially discarded. It allows developers to rollback all changes within a specific foundset, using the method.

In scenarios where you need to revert all changes made to records within a related foundset, such as in a master-detail relationship, you can use the method on the related foundset. This ensures that all unsaved modifications to the related records are discarded.

To globally revert all changes in the current session, use . This global undo mechanism is particularly powerful when you want to discard all changes made during a session, useful in complex applications where multiple changes across various foundsets might need to be undone.

Auto-enter fields are automatically populated during record creation or editing, such as timestamps, user IDs, or sequential numbers. Auto-enter values reduce manual input errors and ensure consistency across records. They are especially useful for fields that require a unique or calculated value at the time of creation. You can find more information about auto-enter.

Table events are triggers that execute specific scripts when data in a table is inserted, updated, or deleted. They can be used for logging, cascading updates, or other automated tasks. You can find more information about table events.

here
getChangedData()
record.exception
revertChanges()
here
foundset.createRecord()
createRecord(onTop)
createRecord(onTop, changeSelection)
createRecord(index)
createRecord(index, changeSelection)
deleteRecord()
deleteRecord(record)
deleteRecord(index)
deleteAllRecords()
getFoundSetUpdater(foundset)
reverted
Auto Save
saveData(record)
saveData(foundset)
saveData()
databaseManager.getFailedRecords()
databaseManager.startTransaction()
databaseManager.commitTransaction()
databaseManager.rollbackTransaction()
revertEditedRecords(foundset)
revertEditedRecords(foundset)
databaseManager.revertEditedRecords()