Procedures and Triggers Usage

Navigation:  Knowledge Base > User Console > Applications > Application Manager > Database Manager > Triggers >

Procedures and Triggers Usage

Previous pageReturn to chapter overviewNext page

Below shows the usage of Triggers and Procedure in Appexe.

 

In below  example User need to create a Procedure and a Trigger and then create an Application in Appexe. In the Application user need to apply actions like Insert and Update which will call the Trigger, and the Procedure is triggered in turn. (To start with , user need to create a Table e.g emp)

 

Details:

Parent Page: Page1

1) User can enter empname and salary and insert data to emp table

 

2) User can Update empname in the emp table.

 

3) User can go to child page to see the records in emp table.

 

Child Page: list

Displays the records of emp table

 

Procedure: emp_stamp

1) Raises Error message if the empname field is empty in the table.

2) Raises Error message if the salary field is empty.

3) Raises Error message if the salary field is negative.

4) It stores the last date and last user.

 

Trigger: emp_stamp

It Triggers the Procedure on following actions:

1)Insert on emp table

2)Update on emp table

 

Table: emp

Fields: id, empname, salary, last_date, last_user

 

Step 1: Create Parent page and Child Page in Page Editor as shown below.

 

mobilous_appexe_console_applications_Trigger_usage_pageStructure

 

Step 2: Add Two TextFields and Three RoundButton UI parts on the Parent Page  "Page1" as shown below.

 

mobilous_appexe_console_applications_Trigger_usage_page1

 

Step 3: Set DB Settings to Service name as "Mobilous" and Table as "emp" on Child Page "list" . Add Labels for displaying field names on the List Page.

 

mobilous_appexe_console_applications_Trigger_usage_listpage

 

Step 4: Add "Remote Insert" action to Insert RoundButton on Parent Page "Page1". Here "empname" and "salary" fields are inserted.

 

mobilous_appexe_console_applications_Trigger_usage_insert_action

 

Step 5: Add "Remote Update" action to Update RoundButton on Parent Page "Page1". Here user can update e.g "empname".

 

mobilous_appexe_console_applications_Trigger_usage_update_action

 

Step 6: Add "Go To Child Page" action on "list" RoundButton on Parent page "Page1".

 

mobilous_appexe_console_applications_Trigger_usage_gotochildpage_action