1 Introduction

The form component BOX allows JavaScript function execution, as well as statement execution, on a record in the result set. This is referred to as an "action". Actions will be displayed in a context menu when right-clicking an element of the box.


XSQL statements or JavaScript functions can be executed on a record by simply right-clicking.


As a starting point, SQL-Tree requires the basic Axional Studio infrastructure, which includes:

  • Axional Studio Server, properly installed
  • Dictionary database
  • A target database

** The previous configuration is explained in detail in the Axional Studio/Setup section.

 

2 Architecture

Actions allow statements or JavaScript functions to be executed:

  • Statement Execution: Use UEL Expressions to get the values of the selected record.
  • JavaScript Functions: Use JavaScript expressions to get the values of the selected record.

In the context menu, an order of actions can be set and icons can be added to each action. The action is only shown if its evaluation condition returns 'true'.


Clicking "Action" brings up a model window with messages and/or form fields. When the user accepts the form, a statement or JavaScript function will be executed.

 

2.1 Physical Model

 

2.1.1 Main Object

wic_jrep_box_celldata_action
Label Description
Menu ID Menu ID
Box ID Box identifier
Action Id Action Identifier
Order Order
Activation condition If condition is true, menu will be activated

  • Format: JS_EXPR
Label Label to show in menu
Icon Icon to display in menu
Confirm Indicates if confirmation is needed before the Execute Action button

  • Default: 1
  • Values:
    • 1: Yes.
    • 0: No.
Type Type of execution

  • Default: 0
  • Values:
    • 0: Execute. Execute
    • 1: Javascript . Javascript
Size form Size form

  • Default: 0
  • Values:
    • 0: Auto.
    • 1: Small.
    • 2: Medium.
    • 3: Large.
SQL / XSQL statement / JavaScript SQL / XSQL statement or JavaScript

  • Format: SQLCOND_EXPR
User created User who created the object

  • Default: USER
Date created Date created

  • Default: CURRENT
User updated User who performed most recent modification

  • Default: USER
Date updated Date updated

  • Default: CURRENT
Actions
Button Title Notes
ACTION_RENUMERAR Renumber Renumerate buttons with a gap of 2 positions
 

2.1.2 Fields

wic_jrep_box_celldata_action_field (wic_jrep_box_celldata_action_f)
Label Description
ID Button identifier
Position Field position
Field tabname Name of the table where the column description was obtained
Column name Column source where the data description to be applied is found
Default Default value
Size Field size
Type Type or nature of field

  • Default: 1
  • Values:
    • 1: CHAR.
    • 4: DATE.
    • 3: DECIMAL.
    • 2: INTEGER.
    • 5: DATETIME.
Is input Indicates whether input needs to be entered

  • Default: 0
  • Values:
    • 1: Yes.
    • 0: No.
Is nullable Indicates whether null is allowed

  • Default: 0
  • Values:
    • 1: Yes.
    • 0: No.
Reference tabname Reference table name
Reference method Reference method name
SQL Vars (Form:SQL) SQL variables (Form:SQL)
Column mapping (Form:SQL) Data mapping Form - SQL
 

3 Implementation

The following sections describe how to create various actions.

 

3.1 Javascript Functions

The user must open their dictionary application and go to the form object where they want to add an action. Next, these steps must be followed:

  1. Enter SQL BOX which allows actions
  2. Enter the Action tab and add a new record with the following values:
    • Type: Javascript.
    • Order: 1
    • Tag: TEST_ACTION_JS
    • Confirm: 1
    • Icon: 0
    • Activation Expression: 1==1
    • Javascript:
 

3.2 Execute Function

The user must open their dictionary application and go to the form object where they want to add an action. Next, these steps must be followed:

  1. Enter SQL BOX which allows actions
  2. Enter the Action tab and add a new record with the following values:
    • Type: Execute
    • Order: 1
    • Tag: TEST_ACTION_EXECUTION
    • Confirm: 1
    • Icon: 0
    • Activation Expression: 1==1
    • Statement Execution:
 

3.3 Execute Function with Form

The user must open their dictionary application and go to the form object where they want to add an action. Next, these steps must be followed:

  1. Enter SQL BOX which allows actions
  2. Enter the Action tab and add a new record with the following values:
    • Type: Execute
    • Order: 1
    • Tag: TEST_ACTION_EXECUTION
    • Confirm: 1
    • Icon: 0
    • Activation Expression: 1==1
    • Statement Execution:
  1. Add box relationships field (an SQL table box). Add a new record:
    • Position: 2
    • Tab name: virtual
    • Column name: TEST_FIELD
    • Size: 10
    • Type: Char
    • Is input?: true
 

4 Box Supports Actions

The boxes which supports actions are next:

  • SQL-TABLE
  • SQL-TREE

 

5 To Do

ACTIONS will soon offer new features for a wider set of functionalities and options, which are summarized below:

  • Add referenced values

 

6 Appendix

 

6.1 Use of JavaScript Record Columns on Evaluation Condition

For the evaluation condition, a column name can be used as a JavaScript variable. If the result returned is a variable with name ID, it can be used as seen below:

 

6.2 Use Record Columns on Statement-Type Actions

For actions associated with XSQL statements, column names can be used as UEL Expressions. If the result returned is a variable with name ID, it can be used as seen below:

 

6.3 Use Record Columns on JavaScript-Type Actions

For actions associated with JavaScript, column names can be used as JavaScript variables. If the result returned is a variable with name ID, it can be used as seen below:

 

6.4 Use Action Form Fields on Actions (Statement or JavaScript)

For actions associated with JavaScript functions or XSQL statements, field form actions can be used with the ? character. The fields' order is important in order to correctly replace each ? character. The first field value replaces the first ? character found, the second field replaces the second ? character found, and so on.