Hash Variables

From nuBuilderPro
Jump to: navigation, search

The way Hash Variables are used in nuBuilder is by simply having PHP do a search and replace on the SQL or PHP code before it is run.

This technique is ideal for all situations other than in the case where the programmer needs to loop through a variable number of rows in a subform. In cases like these, Hash Values can be retrieved with an array named $nuHash. So that the value held in #invoiceItem0003ite_cost# can be accessed with $nuHash['invoiceItem0003ite_cost'] or like this $nuHash['invoiceItem'.$row.'ite_cost']. For an example of using the $nuHash variable to check a subform for consistency click here.


SELECT IF('globeadmin' = '#nu_access_level#','1','0');


Before running this SQL statement nuBuilder will replace any matching Hash Variable with actual variables so that the SQL now becomes..


SELECT IF('globeadmin' = 'dataentry','1','0');


Now the SQL statement can be run and will return '0' not letting the user with an Access Level of 'dataentry' access to that Action Button. This works the same with HTML and PHP, first replacing the Hash Variables with values and then running the code.

Breadcrumb Title SQL Display Conditions Before Browse Before Open Before Save/Delete After Save/Delete Default Value Default Filter for Browse Screen Record ID Display SQL Dropdown SQL Listbox SQL Subform SQL HTML Report Labels Subform Objects Lookup PHP Functions
#TABLE_ID# X X X X X X X X X X X X X X X
#FORM_ID# X X X X X X X X X X X X X X X
#RECORD_ID# X X X X X X X X X X X X X X X X
#PREVIOUS_RECORD_ID# X X
#SUBFORM_RECORD_ID# X X
#nu_edited_record# X X X X X X X X X X X X X
#nu_cloned_record# X X X X X X X X X X X X X
#nu_new_record# X X X X X X X X X X X X X
#nu_browse_filter# X X X
#call_type# X X X X X X X X X X X X X X X
#session_id# X X X X X X X X X X X X X X
#nu_user_id# X X X X X X X X X X X X X X X
#nu_user_group# X X X X X X X X X X X X X X X
#nu_access_level# X X X X X X X X X X X X X X X
#nu_user_name# X X X X X X X X X X X X X X X
#nu_smtp_user_name# X X X X X X X X X X X X X X X
#nu_smtp_password# X X X X X X X X X X X X X X X
#nu_smtp_host# X X X X X X X X X X X X X X X
#nu_smtp_from_address# X X X X X X X X X X X X X X X
#nu_smtp_port# X X X X X X X X X X X X X X X
#nu_smtp_use_ssl# X X X X X X X X X X X X X X X
#nu_smtp_from_name# X X X X X X X X X X X X X X X
Starting Object Values (eg.#cus_name#) X X X X X X X X
New Object Values (eg. #cus_name#) X X X
#page# X
#pages# X
#description# X
#code# X
#year# X
#month# X
#day# X
#hour# X
#minute# X
#second# X
Next Number From A Table (eg. #invoice_number#) X

Hash Variable for Screen

#TABLE_ID#

An unique string that can be used as a temporary table name that can be referenced later.



$s = "CREATE TABLE #TABLE_ID# SELECT * FROM customer WHERE customer_id = '#inv_customer_id#'";
$t = nuRunQuery($s);
$r = db_fetch_object($t);

-- In the above example..

#TABLE_ID# is a system generated id created by nuBuilder.
#inv_customer_id# is an Object on an Edit Form.

#FORM_ID#

The Primary Key of the Browse or Edit Form.

#RECORD_ID#

The Primary Key of the Current Record.

#PREVIOUS_RECORD_ID#

The Primary Key of the Cloned Record, or blank if a New Record.

#SUBFORM_RECORD_ID#

The Primary key of the subform object

#nu_edited_record#

1 if record has just been edited, otherwise 0

#nu_cloned_record#

1 if record has just been cloned, otherwise 0

#nu_new_record#

1 if record has just been added, otherwise 0

#call_type#

The API action now being run.

#session_id#

Session ID of this user's current session.

#nu_user_id#

ID of current user.

#nu_user_group#

Group of current user

#nu_access_level#

Access Level of current user.

#nu_user_name#

Name of current user.

Starting Object Values (eg. #cus_name#)

Starting values.

New Object Values (eg. #cus_name#)

Most recently changed values.

Next Number From A Table (eg. #invoice_number#)

The next incremented number in the table invoice_number

The structure of this table should be created like this..


CREATE TABLE invoice_number (
  id int(11) NOT NULL AUTO_INCREMENT,
  extra_field varchar(25) NOT NULL,
  PRIMARY KEY (id),
  KEY extra_field (extra_field)
)

This can then be used here.

#nu_smtp_username#

The email user name for the current user. e.g. noreply@nubuilder.net

#nu_smtp_password#

The email password for the current user. e.g. ******************

#nu_smtp_host#

The emails domain for the current user. e.g. smtp.gmail.com

#nu_smtp_from_address#

The email address the current user will use to send emails. e.g. noreply@nubuilder.net

#nu_smtp_from_name#

The name that will be displayed on emails sent by the current user. e.g. nuBuilder Email

#nu_smtp_port#

The port number the smtp server is hosted on. e.g. 465

#nu_smtp_use_ssl#

Should SSL be used when sending emails by the current user. e.g. Yes

Hash Variables that can be used within a Report Label Object

#page#

Current Page Number.

#pages#

Total Pages in report.

#description#

The Report Description.

#code#

The Report Code.

#year#

Current 4 digit year.

#month#

Current 2 digit month.

#day#

Current 2 digit day.

#hour#

Current 2 digit hour. (12 hour)

#minute#

Current 2 digit minute.

#second#

Current 2 digit seconds.