Best practices when using the Single Save Function

  • 16 February 2021
  • 0 replies
  • 44 views

Badge +3
 

Best practices when using the Single Save Function

KB001429

PRODUCT
K2 smartforms
LEGACY/ARCHIVED CONTENT
This article has been archived, and/or refers to legacy products, components or features. The content in this article is offered "as is" and will no longer be updated. Archived content is provided for reference purposes only. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.

 

Introduction

In this Knowledge Base article you will find guidance on best practices when using the single save function. This content will be updated as additional best practices are identified.

 

 

Single Save:

When performing a single save of a record, regardless of whether it is a many-to-many relationship Check Box List usage in an Item View, or using the Update master and detail values when a control raises an event Template the main View’s key field should be cleared or reset before creating new records.

Usage Scenarios

  • When loading an item from a List View for editing, ensure that the Load method is executed to ensure that the correct ID is loaded
  • When adding new items and planning to create another one, ensure that the ID field is cleared first before entering new data. This ensures no new data will be linked to the wrong parent ID.
  • When using the Update master and detail values when a control raises an event Template and the primary key is not visible, add an action on the template to ensure that IDs are created correctly. For example:
    • When the create button is clicked
    • Clear the primary key field/textbox/etc. Blank data can be transferred into the primary key field, or the Clear method action can be used on the control
    • Then execute the create method on the main View (with the relevant mappings)
    • Then execute the rest of the methods in a batch

Setup of the Clear action depends on the specific scenario. If you have a List View opening a subform to capture new records, it will automatically be cleared. If you reuse that subform for loading, the necessary record will be loaded so the ID will be correct. 

Example of clearing the key field or control:

Add the Clear action as shown below.
Image

When configuring the Clear method, the control is selected on the Output Mappings tab, but no value is populated.
Image

 


0 replies

Be the first to reply!

Reply