Procedures: Difference between revisions

From nuBuilderForte
Jump to navigation Jump to search
Line 55: Line 55:
Generally each event is used for different purposes.
Generally each event is used for different purposes.


'''Yes''' and '''No'''  is decided by [[PHP#nuDisplayError|nuDisplayError()]] in the above flowchart.
===Before Browse===
===Before Browse===
*Create a temp table to use as the browsable table.
*Create a temp table to use as the browsable table.

Revision as of 01:57, 27 July 2017

nuBuilder Forte can create Procedures.

A Procedure is PHP code run to manupulate the database.


Building a Procedure

Procedures are written in PHP to do things to the database directly.

Here are 2 examples of where a Procedure can be used.

  1. To create the table used in a Report.
  2. Update a stock table after an invoice is created in nuBuilder.

Code

A unique code for this Procedure.

Description

The description of this Procedure.

Group

A field that can be used to help order Procedures in a list.

Launch From

A Launch Form will allow..

  • The user to define the information to be used by the Procedure.
  • Run the Procedure from an Action Button at the top of the Form.

Run

  • In a new window - Appears in a new window much the same as a Report.
  • Hidden - This runs behind the scenes but can display a result using nuDisplayMessage

PHP

A Textarea containing PHP code.

This code can also use Hash Variables that will help you customise nuBuilder.

To edit this, double click on the Textarea and you will open Ace Editor in a full screen.

PHP Library

This subform allows you to add other previously created Procedures to be run when ever this Procedure is.

Running A Procedure

There are 2 ways to launch a Procedure.

  1. Click the Run Procedure Button on the Setup Tab of the Home Form.
  2. Create a Button with a custom click event to run nuRunHiddenPHP or nuRunPHP.

Adding PHP Elsewhere

PHP can be added to run in different places on Forms or Lookups.

These events are used to do different customisable tasks and are run at specific times.

Forms

Generally each event is used for different purposes.

Yes and No is decided by nuDisplayError() in the above flowchart.

Before Browse

  • Create a temp table to use as the browsable table.
  • Add Javascript to the Browse Form with nuAddJavascript().

Before Edit

Before Save

  • Check if saving is allowed.
  • Validate data entry.

After Save

  • Update other tables.

Before Delete

  • Check if deleting is allowed.
  • Update other tables.

After Delete

  • Update other tables.

Lookups

After Browse

This runs after a Lookup Object is changed.