Update, Insert or Delete data. (for use with an UNBOUND component)

Description

Updates, inserts or deletes a record in a table using data submitted from a control on a UX component. The UX component need not have been 'Data Bound' in order to use this action. Contrast this action with the 'Save Submitted Data to Table(s)' action in Server-side action scripting which is used for saving data to tables in a UX component that has been 'Data Bound'.

Used with the UX component.

 Operation type Properties

Operation type
Specify the type of action. Choose 'AUTO-DECIDE' if the action will be determined at run-time based on the value of a field or variable. Choices include UPDATE, INSERT, DELETE, AUTO-DECIDE.
Auto-decide technique
Specify the method to use to determin what the 'AUTO-DECIDE' action will be. You can either call a Javascript function, or check the value in a control. The control is typically bound to the primary key. If the control has a non-blank value (i.e. the record has a primary key value), then the operation is an UPDATE, else, it is an INSERT. Choices include Check value in a control, Call a Javascript function.
Auto-decide javascript function
Specify the name of the Javascript function to call to determine the operation type. This function will be called when the Ajax callback takes place. The function should return 'INSERT', 'UPDATE' or 'DELETE'.
Auto-decide control to watch
Specify the name of the control to watch. The control is typically bound to the primary key. If the control has a non-blank value (i.e. the record has a primary key value), then the operation is an UPDATE, else, it is an INSERT.

 Table type Properties

Type
Only AlphaDAO against SQL databases is supported for this action. Choices include AlphaDAO.

 Table Definition (DBF) Properties

Tablename
Specify the DBF filename.

 Table Definition (AlphaDAO) Properties

Connection string
Connection string property.
Tablename
Specify the table name.
Primary key
Primary key property.
Primary key is auto-increment
Specify if the primary key is an auto-increment value.
Use sequences
Specify if the primary key value is obtained from a sequence
Sequence name
Certain databases, such as Oracle, use sequences for auto-increment values.
Get primary key from
Specify where to get the Primary Key value to identify the record to be updated or deleted. The 'SubmitData-OldValue' option will use the original value in the control before the user made any edits to the control. Choices include SubmittedData-NewValue, SubmittedData-OldValue, Explicit, SessionVariables.
Primary key data map
Specify how the primary key fields in the target table are mapped to controls in this Component. For INSERTS, if the Primary Key is auto-increment, you do not need to specify this property. However, on INSERTS even if the Primary Key is auto-increment, you might still want to specify the property if you want the user to be able to assign an explicit value to the auto-increment field (which is somewhat unusual, but nevertheless still allowed in some databases).
Explicit primary key value
Specify the primary key of the record to update or delete. If the primary key has more than one column, use ||| ( 3 pipes) to delimit segments: e.g. John|||Smith.
Session variable
Specify the name of the session variable that contains the primary key of the record to update or delete. If the primary key has more than one column, use ||| ( 3 pipes) to delimit segments: e.g. John|||Smith.

 Update Settings Properties

Only update dirty fields
Specify if all fields or only dirty fields should be updated.
Validate fields before update
Should the field validation rules be evaluated before the record is updated? If checked, then the update only occurs if there are no validation errors.
Refresh controls after update
Specify if the control that were bound to fields that were updated should be refreshed after the update has taken place.
Set controls to clean after update
Specify the controls that were bound to fields that were updated should be set to 'clean' after the update has taken place
Javascript - after update success
Specify the name of the Javascript function to call after the record was sucessfully updated.
Javascript - after update failed
Specify the name of the Javascript function to call if the udpdate failed.

 Delete Settings Properties

Xbasic - before delete
Specify the name of the Xbasic function to call before the delete is executed. The function prototype must pass in the 'e' object.
Xbasic - after delete
Specify the name of the Xbasic function to call after the delete is executed. The function prototype must pass in the 'e' object.
Javascript - after delete success
Specify the name of the Javascript function to call after the record was sucessfully deleted.
Javascript - after delete failed
Specify the name of the Javascript function to call if the delete failed.

 Insert Settings Properties

Validate fields before insert
Should the field validation rules be evaluated before the record is inserted? If checked, then the insert only occurs if there are no validation errors.
Refresh controls after insert
Specify if the control that were bound to fields that were inserted should be refreshed after the insert has taken place.
Set controls to clean after insert
Specify the controls that were bound to fields that were inserted should be set to 'clean' after the insert has taken place
Javascript - after insert success
Specify the name of the Javascript function to call after the record was sucessfully inserted. The Javascript function takes 'e' as an input parameter. The primary key of the record inserted is available in 'e.primaryKey'
Javascript - after insert failed
Specify the name of the Javascript function to call if the udpdate failed.

 Data Binding Properties

Data binding
Specify how fields in the target table are mapped to controls in this Component.

 Server-side Events Properties

Insert - Before insert SQL computed
This event is typically used for server-side data validation before the insert is executed. Specify the name of the Xbasic function to call before the insert SQL is computed. Allows you to modify data in the e.datasubmitted object. The function prototype must pass in the 'e' object.
Insert - Before insert
Specify the name of the Xbasic function to call before the insert is executed. The function prototype must pass in the 'e' object.
Insert - After insert
Specify the name of the Xbasic function to call after the insert is executed. The function prototype must pass in the 'e' object.
Update - Before update SQL computed
This event is typically used for server-side data validation before the update is executed. Specify the name of the Xbasic function to call before the update SQL is computed. Allows you to modify data in the e.datasubmitted object. The function prototype must pass in the 'e' object.
Update - Before update
Specify the name of the Xbasic function to call before the update is executed. The function prototype must pass in the 'e' object.
Update - After update
Specify the name of the Xbasic function to call after the update is executed. The function prototype must pass in the 'e' object.
Delete - Before delete
Specify the name of the Xbasic function to call before the delete is executed. The function prototype must pass in the 'e' object.
Delete - After update
Specify the name of the Xbasic function to call after the delete is executed. The function prototype must pass in the 'e' object.

 After Save Confirmation Properties

Show a fade out message after record save
Specify if a confirmation message should be shown after a record is saved. Note: Message will not be shown if the action redirects to another page.
Message text - Update
Specify the text of the confirmation message.
Message text - Insert
Specify the text of the confirmation message.
Message text - Delete
Specify the text of the confirmation message.
Placeholder id where message is to be shown
Specify the name of a placeholder where the confirmation message should be shown. TIP: To add a placeholder to the component select the [Placeholder] control in the 'Other Controls' section of the toolbox.
Mesage duration
Specify the duration of the message in milliseconds. For example, 2000 is 2 seconds.
Message style
Specify the style for the message. 'Default' will style the message based on the current component style. 'None' will not apply any style. You can add your own styling to the message text itself. Choices include Default, None.

 Store Current Location Information Properties

Submit location
Indicate if the current location should be submitted. (The user will be prompted for permission to submit location information). The location information is obtained from the browser, or from the device on which the component is running.
Store location data in fields in record
Specify if the submitted location information should be stored in fields in the record you are editing.
Latitude field
Specify the name of the field where the latitude value should be stored.
Longitude field
Specify the name of the field where the longitude value should be stored.
Encode 'location' field with a location object
If the table has a geography/geometry field, should this field be encoded using the lat/lng values that were submitted.
Location field
Specify the name of the location field. (This is a field with geography/geometry data type).
Store data for which operation types
Specify if the current location information should be stored only when Inserting a new record, or when Inserting or Updating a record. Choices include InsertOnly, InsertAndUpdate.

 Refresh List Controls Properties

Refresh List controls
After data is edited, specify if there are any List controls on the component that you want to refresh so that the data in the List controls reflect the edits that were saved.
List controls to refresh
Specify the ids of the List controls you want to refresh.

 Debugging and Global Errors Properties

Display debugging info
Specify if the SQL statements (for SQL tables), or Xbasic code (for .dbf tables) should be shown. Note: If the 'After submit action' is set to redirect, then you will not see the debugging information (unless there is an error), because control will be redirected to the target page.
Debugging information placeholder
Specify where debugging informatin should be shown. If you are working in an application that uses Panels, you will typically put a placeholder in the Panel to show debugging information in the appropriate panel. Set to <Default> for the default placement of debugging information.
Global errors placeholder
Specify where global errors (if a commit error that is not specific to a particular field) should be displayed. If you are working in an application that uses Panels, you will typically put a placeholder in the Panel to show Global errors in the appropriate panel. Set to <Default> for the default placement of global errors.

See Also