Built-in Procedures

add_CSS

add_CSS(url)

Adds CSS file

Parameters:

  • url – CSS url. If the url contains "nocache" string the CSS file will not be cached
add_CSS('mroovka/test.nocache.css');

add_toolbar_option

add_toolbar_option(button_string_literal)

Adds a report toolbar icon. It has the same Awesome Icon as the button. Icon has the same tooltip as the description of the button. Pressing the icon fires buttons “BUTTON_PRESSED” trigger of the button. More detailed description of building menus can be found in the Programmer's Guide.

Parameters:

  • button_string_literal – name of a button
add_toolbar_option('FORMS.SEND_VAT_FORM_TO_IRS');

add_menu_option

add_menu_option(button_string_literal)

the button contributes to the menu. Pressing the menu option fires buttons “BUTTON_PRESSED” trigger. More detailed description of building menus can be found in the Programmer's Guide.

add_menu_option('MENU.Companies');

change_password

change_password(old_password, new_password)

changes current users password to newPassword, after verification of the old password

clear_record

clear_record

Clear (remove) current record from the screen without posting changes to the server

cl_count_records

cl_count_records(outputNumber)

Returns number of record hits the current block will fetch with the current where condition

Parameters:

  • outputNumber - stores result
-- BUTTON_PRESSED z_count number; begin go_item(‘ORDERS.ORDER_DATE’); cl_count_records(z_count); message_info('Record count:' ||to_text(z_count)); exception when others then message_error(ERROR_MESSAGE); end;

cl_excel_import

cl_excel_import(block_name, configuration_json)

Import excel file data into a block. Import accepts xls and xlsx formats. Import expects the data to reside in the first sheet of the file. The file has to be uploaded using file upload Item. The procedure imports the last uploaded file and then deletes the blob from the intermediary system table. The procedure is carried out on the server. It passes to the server master block items of the block and Items with non null default values. Then performs inserts on the DML database table, corresponding to the block. It uses data from the Excel file, master Items of the block and items with default values. If an item with default value is not specified in configuration_json parameter (maybe because is not present in the Excel File) or is empty then the value suplied from the form is used. Items with “:increment” default value receive row number relative to the first row of the import. The procedure will not fire any CloudaIDE Form Triggers of the block, because the loading is performed completely on the server. To do additional processing the DB triggers can be used.

Parameters:

  • block_name – text. Name of the block the data is imported into
  • configuration_json – text. Specification of the import data. "firstRow" – number of the first imported row. Starts with 1. Primary use – to skip column names. "columns" – array of two element arrays – item_name, column (excel) number. Starts with 1. The item has to correspond to the DML table of the block
cl_excel_import('DETAILS', '{ "firstRow": 2, "columns": [ ["PRODUCT_ID", 1], ["PRODUCT_MSRP", 2], ["QUANTITYORDERED", 3] ] }' );

cl_last_record

cl_last_record

Navigate to the last record in the current block

cl_send_keypress

cl_send_keypress(keyCode, control, alt, shift)

Sends a keypress to the current item. The procedure can emulate effects of the keypresses of the Functional keys combination listed in the help screen.

Parameters:

  • keycode – Javascrip key code
  • control – boolean notify, that the Control key was down
  • alt – boolean notify, that the Alt key was down
  • shift – boolean notify, that the Shift key was down

Note – sometimes after the cl_send_keypress key is called there might be necessary to wait after the effect of sending the key will be complete. In this cases use the cl_sleep procedure to wait, after the key press processing is finished to do further trigger processing. You have to guess what waiting period to set. Alternatively you can use a flag or check other conditions and loop until the condition is fulfilled.

-- "Press" F8 on ORDERS.ORDER_NUMBER item begin go_item('ORDERS.ORDER_NUMBER'); -- F8 Key code is 119 cl_send_keypress(119, false, false, false); exception when others then message_error(ERROR_MESSAGE); end;

cl_show_hourglass

cl_show_hourglass(show)

show/hide hourglass. Hourglass is always hidden after completion of a trigger so cl_show_hourglass(false) is of limited use

Parameters:

  • show – if true then show – hide otherwise

cl_sleep

cl_sleep(milliseconds)

Sleep current trigger not less than milliseconds

Parameters:

  • milliseconds – sleeping time

close_form

close_form(accept)

close current form

Parameters:

  • accept – boolean – if true then form posts its data to the database and performs validations. If any of those fail the form remains open. Calling triggers success value is equal to the accept parameter value

Remark – close_form without parameter from the releases below 1.1.1100 is equivalent to close_form(false)

close_report

close_report

closes report/blob preview window.

confirm

confirm(display_text, ok_button_selected)

display confirmation message box displaying display_text. If ok_button_selected is true, then the Yes button is the default button, and otherwise No is the default button

create_timer

create_timer(timer_name, timer_milisec, repeat)

Creates timer to execute TIMER_EXPIRED trigger on specified moments ot time

Parameters:

  • timer_name – text – name of the timer
  • timer_milisec – moment of the timer in miliseconds
  • repeat – if true timer will execute periodically
create_timer('test', 1000, true);

display_blob

display_blob(table_name, column_name, id_column_name, id_value, filename, mime_type_column)

Display blob in preview. The trigger does not wait until the the display completes. The file comes from the column of a table specified by parameters. The row is specified by the value of the id of the row

Parameters:

  • table_name – text, name of the blob's table
  • column_name – text, name of the blob's column
  • id_column_name – text, name of the table's id Column
  • id_value – oidn(encrypted number), value of the row's ID
  • filename – file name
  • mime_type_column - text, name of the column containing MIME type code of the blob's content

If uppercased table_name contains string TEMP then the row containing the BLOB will be deleted after the download completes.

destroy_timer

destroy_timer(timer_name)

Destroys (stops) the timer

download_data

download_data(block, format [,item]...)

Download block data in specified format

Parameters:

  • block – block name
  • format – download format. Supported formats – csv, html and json
  • item – names of the database items in the download. If none specified the download will consist of all the items
download_data(PRODUCTS, html);

download_from_blob

download_from_blob(table_name, column_name, id_column_name, id_value, filename, mime_type_column)

Start to download file from blob. The trigger does not wait until the download completes. The file comes from the column of a table specified by parameters. The row is specified by the value of the id of the row

Parameters:

  • table_name – text, name of the blob's table
  • column_name – text, name of the blob's column
  • id_column_name – text, name of the table's id Column
  • id_value – oidn(encrypted number), value of the row's ID
  • filename - file name
  • mime_type_column - text, name of the column containing MIME type code of the blob's content

If uppercased table_name contains string TEMP then the row containing the BLOB will be deleted after the download completes.

download_from_filesystem

download_from_filesystem(path, filename, content_type)

Start to download file from server. The trigger does not wait until the download completes

Parameters:

  • path – encrypted text containing the path to the file (including file name)
  • filename – text,file name of the downloaded file
  • content_type – text MIME type of the file content. If null the server will report application/octet-stream

duplicate_record

duplicate_record

copy all data of the previous record into a new record

enter_query

enter_query

put the current block in the enter_query mode

execute_query

execute_query

execute query in the current block

begin enter_query; :COMPANY.NAME:='Brothers'; execute_query; exception when others then message_error(ERROR_MESSAGE); end; -- the current block (COMPANY) will be looked for records containing the 'Brothers' word. -- The trigger logic assumes, that the COMPANY is the current block.

get_data

get_data(block, format, outDataItem [,item]...)

Fetch block data in specified format

Parameters:

  • block – block name
  • format – data format. Supported formats – csv, html and json
  • outDataIem - text data item containing result
  • item – names of the database items in the download. If none specified the download will consist of all the items

Dates in JSON format are in ISO 8601. If the Item format string contains minutes then it is written using 8601 date format with Z zone and only date portion otherwise.

get_data(PRODUCTS, json, text_var);

get_where_clause_text

get_where_clause_text(block_name, encrypted_where_text)

This procedure gives the developer the value of the last sql query where phrase of the select statement that was performed on a block. It is encrypted text. The encryption gives the possibility to defend the sever against an injection attack. The value can be used for example as an URL parameter. Several scenarios can be used. For example: The value can be sent back to the server to decrypt and to temporarily store the value in a table. To protect the server against abuse the programmer can create a servlet filter that will check if the value sits in the table and delete it from the table after use.

Parameters:

  • block_name – block identifier
  • encrypted_where_text – (in out) parameter, that will return Sql where clause of the latest block search operation

get_select_where_and_order

get_select_where_and_order(block_name, encrypted_select, encrypted_where_text, encrypted_order_by_text)

This procedure gives the developer the values of the latest sql select, query where and order by phrases of the select statement that was performed on a block.It is encrypted text. The encryption gives the possibility to defend the sever against an injection attack. The values can be used for example as an URL parameters. Several scenarios can be used. For example: The values can be sent back to the server to decrypt and to temporarily store the values in a table. To protect the server against abuse the programmer can create a servlet filter that will check if the values sit in the table and delete them from the table after use.

Parameters:

  • block_name – block identifier
  • encrypted_select – (in out) parameter, that will return Sql select clause of the latest block search operation
  • encrypted_where_text – (in out) parameter, that will return Sql where clause of the latest block search operation
  • encrypted_order_by_text – (in out) parameter, that will return Sql order by clause of the latest block search operation

get_select_where_and_order2

get_select_where_and_order2(block_name, encrypted_select, encrypted_where_text, encrypted_order_by_text)

This procedure is almost identical as the get_select_where_and_order procedure. It lets to specify an expression to specify block name. So the same procedure call can be used to inspect phrases of many blocks. This procedure gives the developer the values of the latest sql select, query where and order by phrases of the select statement that was performed on a block. It is encrypted text. The encryption gives the possibility to defend the sever against an injection attack. The values can be used for example as an URL parameters. Several scenarios can be used. For example: The values can be sent back to the server to decrypt and to temporarily store the values in a table. To protect the server against abuse the programmer can create a servlet filter that will check if the values sit in the table and delete them from the table after use.

Parameters:

  • block_name – block name expression
  • encrypted_select – (in out) parameter, that will return Sql select clause of the latest block search operation
  • encrypted_where_text – (in out) parameter, that will return Sql where clause of the latest block search operation
  • encrypted_order_by_text – (in out) parameter, that will return Sql order by clause of the latest block search operation
get_select_where_and_order2('BLOCK' || suffix_variable, encrypted_select, encrypted_where_text, encrypted_order_by_text); -- VERSUS get_select_where_and_order(BLOCK, encrypted_select, encrypted_where_text, encrypted_order_by_text);

go_item

go_item(item_name)

moves cursor to the item_name item, performing necessary processing. Sets success to true if the navigation was successful

go_record

go_record(record_number)

move cursor to record_number record. Records in the block are numbered staring from 1

host

host(command_line, encrypted, result, encrypted_result,exit_code, charset_name)

Performs command_line on application server. Returns standart output together with standard error as a result

Parameters:

  • command_line – etext – command with parameters. Parameters have to be separated with single spaces. Command line has to be delivered to client as etext (encrypted text) to prevent injection attack
  • encrypted – boolean – if true then the "encrypted_result" parameter is set to output contents and the "result" parameter is set to null. Otherwise the "result" parameter is set to output contents and the ‘encrypted_result’ parameter is set to null
  • result – in out – text
  • encrypted_result – in out – etext
  • exit_code – in out – number – OS depending process exit code of the command
  • charset_name – text – character - set name of the output received from the command
-- BUTTON_PRESSED command etext; z_result text(1000); z_result_encoded etext; z_exit_code number; begin COMMAND(command); post; host(command, false, z_result, z_result_encoded, z_exit_code, 'cp852'); message_info(z_result); exception when others then message_error(ERROR_MESSAGE); end;

The 'command' variable is obtained via a stored procedure. The bellow example shows how to create such procedure on Oracle RDBMS server. It can have of course many other parameters. The server will return a value to etext variable, that can be sent to the server for execution using 'host'. This way the server is protected from command line injection attacks from the client, because the client itself does not know how to produce an etext value without the server:

create or replace procedure COMMAND(p_command in out varchar2) is begin p_command:='cmd /q /c c:\zapas\test.bat *.txt *.bat'; -- p_command:='c:\zapas\test.bat *.txt *.bat'; – also valid end COMMAND;

If you use cmd.exe In Windows environment do not forget to include the /c parameter. Otherwise your program will hang indefinitely waiting to cmd.exe to finish.

list_values

list_values

list values (call LOV) in the current item

log_in

log_in(user_string, password_string)

Logs an user in an application that requires authentication.

Parameters:

  • user_string – user identifier
  • user password – password

Ia an application requires authentication only procedures, which names are prefixed (case insensitive) with "PRELOG__" string can be executed before login to the database (do not require previous login) This way the there can be some initial communication with the server. The procedures can use oidn and etext parameters. If such parameters are used a run-time error will occur. The procedures should be designed with care because of security risks. No other interaction of the application with the server is possible before the completion of the log_in procedure.

logout

logout

Logout on server and go to the starting url

message

message(text)

display text in the status bar

message_error

message_error(text)

display text with error decoration. Set the value of success code to false

message_info

message_info(text)

display text with info decoration

message_warning

message_warning(text)

display text with warning decoration

next_block

next_block

moves cursor to the first navigable item in the next block

next_item

next_item

moves cursor to the next item (as though the return or key tab was pressed). Sets the value of success code according to the result of the possible validations, that might happen as a result of the key press

next_record

next_record

Move cursor to the next record in the current block

next_set_of_records

next_set_of_records

scroll block (screen records -1) towards next records (same sa pressing key pgdn)

open_form

open_form(form_name[[,par_value]...])

open the formName form. Set form parameters to parValue...; the calling routine is suspended until the called form initialization. Then it runs till the completion. It is good practice not to put any code in a trigger after opening another form.

open_form(Firma); open_form(Ledger, :COMPANY.ID, :COMPANY.NAME, to_text(:TOOLS.MONTH,'yyyy-MM-dd'), :COMPANY.VAT_PAYER, :TOOLS.MONTH <=:FIRMA.CLOSED_MONTH);

open_page

open_page(url)

Open page in new window/tab

Parameter:

  • url – url of the page to open
open_page('https://drive.google.com/open?id=1bWiX7BxEeGapW_D-o_RUkBOAJ7rnu4i4');

post

post

post current record to the database and client store. Perform validations. Set the success system variable according to the post operation result

previous_block

previous_block

move cursor to the first navigable item in the previous block

previous_record

previous_record

move cursor to the previous record in the current block

previous_set_of_records

previous_set_of_records

scroll block (screen records -1) towards previous records (same sa pressing key pgup)

protect_tree

protect_tree(block, protect)

set the block and all the blocks down the master-detail tree updatable and insertable properties to boolean protect value. Used to bulk lock or unlock all blocks depending on particular record

-- To protect the data of orders from change from the user interface one might issue the following call: protect_tree('ORDERS',:ORDERS.STATE!='Open');

raise

raise(exception_type_id, exception_number, message)

raise exception

Parameters:

  • exception_type_id - exception type Identifier
  • exception_number – number of the exception
  • message – message of the exception
raise(AccountError, 5, 'insufficient funds');

refresh

refresh

retrieve the current record from the database with current values, forgetting all client changes. Refresh all dependent master/detail tree.

refresh_tree

refresh_tree

refetch all blocks down the master-detail tree from the database (current block exclusive)

remove_html_attribute

remove_html_attribute(htmlID, attName)

removes html attribute of an HTML element

Parameters:

  • htmlID – value of the id attribute of the element
  • attName – name of the attribute
remove_html_attribute('selection-button', ’disabled’);

run_jasper_report

run_jasper_report(report_name,report_format,[[,par_value]....]) [base_block block_name]

run the report_name report. Set all the parameters. If the criteria_block is set then add a p_where parameter, that contains the last query criteria from the block and p_block that contains the last ORDER BY phrase. report_format can be one of pdf, html, xls, xlsx, rtf, odt, ods, docx, pptx.

For more details, see the Programmers guide - Jasper Report
run_jasper_report(ledger, 'pdf', :parameter.company_id, :parameter.month);

run_report

run_report(report_name[[,par_value]....]) [criteria_block block_name]

run the report_name report. Set all the parameters. Parameters have to be of the text data type. If the criteria_block is set then add a p_where parameter, that contains the last query criteria from the block

run_report(ledger, :parameter.company_id, :parameter.month);

send_mail

send_mail(address_to, address_from, subject, message_text)

sends email

Properties:

  • address_from – sender e-mail. If null then the sender will be the default server senderm as configured in the Administration application
  • message_text – HTML text of the email

set_block_CRUD

set_block_CRUD(block_name, create, retrieve, uptext, delete)

set the block_name insertable, queryable,updatable and deleteable properties to the respective values. If an argument is null then do not change the property

--To set LEDGER block to query only mode issue the following call set_block_CRUD('LEDGER', false, true, false, false);

set_block_property

set_block_property(block_name, property_name, property_value)

set the block_name property_name property to the property_value

Properties:

  • visible – set the visible property of the block
  • changed – set the changed property for all items of the the block to the specified boolean value
  • caption – set the caption of block (if previously displayed) to the specified text
  • fetch_all – set the fetch property of the block to the specified boolean value. If the property is set to false clean up summaries and do not fetch all rows in one go
  • delete_confirmation – delete confirmation text. If empty – no confirmation text is displayed

set_breadcrumb

set_breadcrumb(breadcrumb_text)

add breadcrumb option to breadcrumb menu. If breadcrumb_text equals null then remove the option.

set_breadcrumb('Orders');

set_context_parameter

set_context_parameter(par_name, par_value)

set the server parameter par_name to par_value value. Datatypes have to agree

set_context_parameter(COMPANY_ID,:parameter.company_id);

set_form_caption

set_form_caption(text)

display text as the form caption

set_html_attribute

set_html_attribute(htmlID, attName, attValue)

sets html attribute of an HTML element

Parameters:

  • htmlID – value of the id attribute of the element
  • attName – name of the attribute
  • attValue – value of the attribute
set_html_attribute('selection-button','style', 'width:15ex; height:6ex; background-color:#ccc');

set_item_property

set_item_property(item_name, property_name, property_value[, property_value2])

set the item_name property_name property to the property_value

Properties:

  • default_value – set the default value of the item to the property_value
  • next_item - set the next_item property of an item to the property_value
  • valid – set the valid property of an item to the property_value. Property_value has to be of the boolean datatype. After invalidating an item, the item will be verified within the next validation event
  • visible – set the visible property of the item. If the current item becomes invisible then the property_value2 item becomes the current item of the block. It is the programmer role to assure that the alternative item is visible
  • changed – set changed property of an item to the property_value. Property_value has to be of the boolean datatype
  • insert_allowed – set whether the item can be entered on new records
  • update_allowed – set whather the item can be updated on old records
  • label – set label of the item to the text specified as the text of the first property_value (third argument)
  • icon – if the item is a button, the third argument replaces icon property set by the designer
  • required – set required property of an item to the property_value. Property_value has to be of the boolean datatype
  • enabled – set enabled property of all the item cells. Property_value has to be of the boolean datatype
  • navigable – set "navigable" property of all the item cells
  • format_mask – set Java format mask. You need to redisplay the Item to get effect of this setting
  • width – change the width of the item; The width has be to expressed in html units. One character width is 1ex
  • max_length – maximal length (in characters) of entered data
set_item_property('INVOICE_LINE.VAT_RATE', default_value, null); set_item_property('INVOICE.VAT_NO', next_item, 'INOICE_LINE.LINE_NUMBER'); set_item_property('COMPANY.STARTING_MONTH', valid, false); set_item_property('INVOICE.VAT_NO', visible, false); set_item_property('DETAILS.PRODUCT_NAME', width, '20ex');

set_order

set_order(block_string_literal, order_string_literal)

set "order by" phrase of the block

set_order('INVOICE','"issue_text" desc');

set_success

set_success(boolean_expression)

sets status code of the trigger to boolean_expression. Useful in validation triggers to specify trigger outcome without raising exceptions or error messages

set_title

set_title(text)

sets title in the browser's tab (HTML title element)

set_where

set_where(block_string_literal, where_string_literal)

set the default where phrase of the block. The where phrase can contain items, globals and parameters in bound variable syntax

set_where('INVOICE','customer_id=:parameter.customer_id');
The set_where and set_order calls are protected from a SQL – injection attack. The phrases are stored on the web server. Web server receives the block and the number of the phrase and parameter name-value pairs, that are passed to a SQL select statement via binding variables. In the whole framework no SQL statements are passed from the client to the server.

validate_item

validate_item

performs item validation. Sets the value of success code according to the result of validation

Every Stored Procedure can be called with only with single signature.

For example in the following code:

etext_variable etext; text_variable text(100); begin procedure_a(etext_variable); procedure_a(text_variable); end;

one of the calls is illegal, because CloudaIDE stores the first met signature as the right one. The workaround of this problem is to create a wrapper stored procedure, that calls procedure_a; for example in Oracle:

create or replace procedure procedure_b(p_parameter1 varchar) as procedure_a(p_parameter1); end;

Then you can rewrite the previous code as:

text_variable text(100); begin procedure_a(etext_variable); procedure_b(text_variable);; end;

There is intention to lift this limitation in future release of CloudaIDE.

Pecularities of procedure calls for particular databases are described in guides for those databases that come with installation scripts.

Arithmetic Functions

abs

abs(number)

absolute value of number

cl_key_code

cl_key_code()

returns Javascript code oft the last pressed key

coalesce

coalesce(val1, val2[,..., valn])

first not null of the val1..valn or null. All arguments have to be of the same datatype

days_between

days_between(text1, text2)

days between two texts. If text1 is later then text2 then the result is positive

highest

highest(val1,val2[,..., valn])

maximal of the val1..valn or null (if any value is null). All arguments have to be of the same datatype

least

least(val1, val2[,..., valn])

minimal of the val1..valn or null (if any value is null). All arguments have to be of the same datatype

length

length(text)

length of text in characters

mod

mod(number, number)

modulo division

months_between

months_between(text1, text2)

months_between returns number of months between texts text1 and text2. If text1 is later than text2, then the result is positive. If text1 is earlier than text2, then the result is negative. If text1 and text2 are either the same days of the month or both last days of months, then the result is always an integer. Otherwise system calculates the fractional portion of the result based on a 31-day month and considers the difference in time components text1 and text2.

round

round(number1, number2[, rounding])

rounds number1 to number2 scale, according to a rounding algorithm. Default algorithm is HALF_UP.

Rounding algorithms

  • CEILING - Rounding mode to round towards positive infinity. If the number1 is positive, behaves as for UP; if negative, behaves as for DOWN. Note that this rounding mode never decreases the calculated value
  • FLOOR - Rounding mode to round towards negative infinity. If the number1 is positive, behave as for DOWN; if negative, behave as for UP. Note that this rounding mode never increases the calculated value.
  • HALF_DOWN - Rounding mode to round towards "nearest neighbour" unless both neighbours are equidistant, in which case round down. Behaves as for UP if the discarded fraction is > 0.5; otherwise, behaves as for DOWN.
  • HALF_EVEN - Rounding mode to round towards the "nearest neighbour" unless both neighbours are equidistant, in which case, round towards the even neighbour. Behaves as HALF_UP if the digit to the left of the discarded fraction is odd; behaves as HALF_DOWN if it's even. Note that this is the rounding mode that minimizes cumulative error when applied repeatedly over a sequence of calculations.
  • HALF_UP - Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round up. Behaves as for ROUND_UP if the discarded fraction is ≥ 0.5; otherwise, behaves as for ROUND_DOWN. Note that this is the rounding mode that most of us were taught in grade school. DOWN Rounding mode to round towards zero. Never increments the digit prior to a discarded fraction (i.e., truncates). Note that this rounding mode never increases the magnitude of the calculated value.
  • UP - Rounding mode to round away from zero. Always increments the digit prior to a nonzero discarded fraction. Note that this rounding mode never decreases the magnitude of the calculated value.

sign

sign(number)

returns:

  • 1 if number is greater than 0
  • 0 if number equals 0
  • -1 if number is less than 0

system_current_record

system_current_record()

returns number of the current record – counted from 0

to_number

to_number(text)

converts the text to decimal following Java BigDecimal(String) constructor

utf8

utf8(text)

UTF8 character code

ERROR_CODE

error number of the last raised exception

Text Functions

chr

chr(number)

utf8 character of given code (number)

coalesce

coalesce(val1, val2[,..., valn])

first not null of the val1..valn or null. All arguments have to be of the same datatype

escape_html

escape_html(text)

escapes HTML special characters

form_id

form_id()

returns text identifying current instance of the form. Helps to create/identify/clean Javascript/Java/other resources used by the current form

get_html_attribute

get_html_attribute(id, name)

returns the value of the html attribute of the element with given id. If there is no such element or attribute return null

highest

highest(val1, val2[,..., valn])

maximal of the val1..valn or null (if any value is null). All arguments have to be of the same datatype

i18n_message

i18n_message(message_identifier [, parameter] ...)

Creates localized messages, using properties files and parameters

Parameters:

  • message_identifier – a message identifier, under which the message is referenced in the I18nMessages.properties file in the I18nMessages directory. This file contains messages for the default language. Other files, with names extended with the locale identifier contain messages for the other languages like e.g. I18nMessages_ru.properties for the Russian language
  • parameters – zero or more expressions that are passed to formatting to the properties files to replace placeholders (like e.g. {0}) in the message. The parameters are counted from 0

If some message identifier is used within a i18n_message call with certain signature then it the other calls with this message identifier have to fit the same signature. In other words [,parameter] ... sequence for set of calls with the same message identifier should have the same datatype sequence (no overloading of message identifier is allowed).

For more detailed discussion of the internationalization of the messages consult Multi-lingual Messages in the Programmers Guide

least

least(val1, val2[,..., valn])

minimal of the val1..valn or null (if any value is null). All arguments have to be of the same datatype

list_item_text

list_item_text()

the raw text of LOV item value of the calling form. If the form is not LOV then the function returns null

lower

lower(text)

converts text to lower case

locale_name

locale_name()

returns locale string

lpad

lpad(text_to_pad, length, padding_text)

left pad text_to_pad upto length with padding_text

md5hash

md5hash(text)

returns md5 haxedecimal representation (lower case) hash of supplied text

replace

replace(text, replace_what, replace_by)

replace every occurrence of replace_what in text by replace_by

rpad

rpad(text_to_pad, length, padding_text)

right pad text_to_pad upto length with padding_text

server_parameter

server_parameter(text)

returns settings of server parameters

Properties:

  • MAIL_CONFIGURED – if mail is configured then 'Y' else 'N'

service_url

service_url()

returns full url with which the application was called

substr

substr(text, start_position[, length])

substring length characters of text, starting from start_position. If there is no length then till the last position

system_current_block

system_current_block()

returns name of the current block

system_current_item

system_current_item()

returns name of the current item (block.name)

system_current_form

system_current_form()

returns name of the current form

system_current_value

system_current_value()

returns normalized value of the current item

Normalized value is for:

  • text – the text itself
  • number – dot separated decimal text representation of the number
  • date – text representation of the date according to the following Java format yyyyMMddHHmmssSSS where:
    • yyyy – year
    • MM – month
    • dd – day
    • HH – 24 hour
    • mm – minutes
    • ss – seconds
    • SSS – miliseconds

timer_name

timer_name()

Returns the name of currently executing timer. Outside the TIMER_EXPIRED trigger the function is not usable and returns random values

to_text

to_text(text | date | number[, format_str])

convert text, date or number to text according to Java format string

trim

trim(text)

trim whitespace on boths sides

upper

upper(text)

convert text to upper case

url_parameter

url_parameter(text)

returns text url parameter. Example: if the application was called using http://app.com/?param=value#place url then url_parameter('param') returns 'value'.

ERROR_MESSAGE

error message of the last raised exception

ERROR_TYPE

error type of the last raised exception

Date Functions

add_days

add_days(date, number)

adds number days to the date. Number does not have to be an integer. Allows fractions of a day

add_months

add_months(date, number)

returns the date text plus integer months. The number argument will be truncated to integer. If date is the last day of the month or if the resulting month has fewer days than the day component of date, then the result is the last day of the resulting month. Otherwise, the result has the same day component as date

coalesce

coalesce(val1, val2[,..., valn])

first not null of the val1..valn or null. All arguments have to be of the same datatype

highest

highest(val1, val2[,..., valn])

maximal of the val1..valn or null (if any value is null). All arguments have to be of the same datatype

last_day

last_day(date)

date of the last day of the month

least

least(val1, val2[,..., valn])

minimal of the val1..valn or null (if any value is null). All arguments have to be of the same datatype

sysdate

sysdate

current client date and time

to_date

to_date(text, format_str)

converts text to date according to Java format string

trunc_to_day

trunc_to_day(date)

the date with time part set to zero

trunc_to_month

trunc_to_month(date)

date of the first day of the month

trunc_to_year

trunc_to_year(text)

text of the January 1, of the text argument

Boolean Functions

cl_alt_key

cl_alt_key()

returns true when the Alt key was down on the last keypress

cl_any_modifier_key

cl_any_modifier_key()

returns true when any of Shift, Ctrl, Alt, Meta keys was down on the last keypress

cl_ctrl_key

cl_ctrl_key()

returns true when the Ctrl key was down on the last keypress

cl_i_process_keypress

cl_i_process_keypress(process)

to use in KEY_PRESSED trigger. The function should be used on the start of the trigger. It informs (as side effect) the framework if the trigger takes care of the keypress. Returns the argument (for convenience sake)

Parameters:

  • process – if true – trigger intends to process the keypress. Otherwise the framework will do default keypress processingt

Before doing anything else the trigger should determine if it will process the keypress. It should inform system then of it’s intention and return the control if is not going to process the keypress. So the trigger should follow the example below. You can give it as argument complex boolean expression, so using intermediate boolean variable is not necessary. Don’t use any asynchronous constructs (like database access or messages) before calling this function, because it will cause incomprehensible behavior of the system. Just test the keypress using cl_alt_key, cl_ctrl_key, cl_shift_key, cl_key_code ,cl_any_modifier_key functions and decide on processing by trigger.

-- KEY_PRESSED z_process boolean; begin z_process := cl_key_code() = 66 and cl_ctrl_key(); if not cl_i_process_keypress(z_process) then return; end if; message_info('Ctrl B key Pressed'); exception when others then message_error(ERROR_MESSAGE); end;

cl_shift_key

cl_shift_key()

returns true when the Shift key was down on the last keypresss

in_enter_query

in_enter_query()

form is in enter query mode (user enters query)

if in_enter_query() then message_info('You are entering query'); end if;

is_form_visible

is_form_visible()

tells whether the triggers form is visible. It can be used to differentiate behavior of the timer depending on whether the current form is displayed (on top of the stack)

is_lov_of_protected_item

is_lov_of_protected_item()

true if the form was called as LOV of a protected (from manual changes) item. If the form is not LOV then false.

is_list

is_list()

returns true if the current form was called as list

is_new_record

is_new_record()

returns true if the current record was not written to the database, or in the case of non-database blocks is just created cursor has not left the record yet

is_RTL

is_RTL()

returns true if current session is in right to left mode

on_last_row

on_last_row()

returns true if cursor is on the last row of the data in the current block

regex_test

regex_test(expression, pattern, modifiers)

true if expression matches pattern with modifiers

success

success

returns the success code of the last executed procedure

Context Variables

SESSION

SESSION

the user session number. It is unique in all the system history

USER

USER

user id of currently logged in user. I the authentication is None – the USER value is null

Database Views

MROOVKA_CURRENT_USER

MROOVKA_CURRENT_USER

Logged user data should be accessed from MROOVKA_CURRENT_USER view that contains one row. This data differs from the database user data. Database user identity is the same for all the application sessions and it's use in a CloudaIDE application does not make sense. If the CloudaIDE user is not logged in (authentication None or outside the CloudaIDE session) this view does not contain rows.