Feedback
ScriptCase Macros

SCRIPTCASE MACROS

 

Scriptcase has macros and special variables that allow the user to manipulate events, buttons, applications, security control, manipulate with dates, etc.

Follows a table of all macros and special variables from ScriptCase, including the list of applications that works for each one.

MACROS AND SPECIAL VARIABLES


SQL
sc_begin_trans ("Connection")
This macro starts a set of transactions in the database.
sc_change_connection ("Old_Connection", "New_Connection")
This macro dynamically change the application connections.
sc_commit_trans ("Connection")
Makes all data modifications performed since the beginning of the transaction a permanent part of the database.
This macro is used to combine two or more strings and/or fields from the table.
sc_connection_edit ("Connetion_Name", $arr_conn)
This macro edits an existing connection at runtime.
sc_connection_new ("Connection_Name", $arr_conn)
This macro creates new connections dynamically.

This macro deactivates the Scriptcase standard database error treatment message for an event.

This macro configure the variable that contains the database error message that can occurs during the exclusion of a record.
This macro configure the variable that contains the database error message that can occurs during the addition of a record.
This macro configure the variable that contains the database error message that can occurs during the update of a record.
sc_exec_sql ("SQL Command", "Connection")
This macro execute SQL commands passed as parameter or a SQL command in the SQL field action type.
sc_lookup (Dataset, "SQL Command", "Connection")
This macro executes a SELECT command stored in the second parameter and returns the data in a variable.
sc_lookup_field (Dataset, "SQL Command", "connection_name")
This macro executes a SELECT command stored in the second parameter and returns the data in a variable.
This macro erases the changes made using "sc_change_connection".
This macro undoes the connection edits made by macro "sc_connection_edit".
This macro undoes the connections made by the macro "sc_connection_new".
sc_rollback_trans ("Connection")
This macro discards a set of transations in the data base.
sc_select (dataset, "SQL Command", "Connection")
This macro executes the commands passed in the second parameter and returns the dataset in a variable.
sc_select_field ({Field})
This macro modify dynamically a field that will be recovered in the grid.
sc_select_order ("Field")
This macro modifies the grids "ORDER BY" clause field dynamically.
This macro dynamically adds a condition to the grid WHERE clause.
This macro allows to change the type of return from the dataset of the select commands
sc_sql_injection ({My_Field}) or ($My_Variable)
This macro is used to protect the field/variable against "SQL injection" attempts.
sc_sql_protect (Value, "Type", "Connection")
This macro protects the value passed as parameter according with the used database.
This macro is used to make a reference of the where clause currently used.
Retrieve where clause used in original select command of the application.
Variables - Database Database Variables
Global variables containing database access values used by main connection.


Date
sc_date (Date, "Format", "Operator", D, M, Y)
This macro calculates and returns increments and decrements using dates.
sc_date_conv ({Field_Date}, "Input_Format", "Output_Format")
This macro converts the date field passed as parameter with an input format to another field with an output format.
sc_date_dif ({Date1}, "Format Date1", {Date2}, "Format Date2")
This macro calculates the difference between two dates (passed as parameters) returning the result in days.
sc_date_dif_2 ({Date1}, "Format Date1", {Date2}, "Format Date2", Option)
This macro calculates the difference between two dates returning the amount of days, months and years.
sc_date_empty ({Field_Date})

This macro checks if a date field its empty returning a boolean.

sc_time_diff ({datetime_01}, "Date_01 Format", {datetime_02}, "Date_02 Format")
Calculate difference in hours, returning the amount of hours, minutes and seconds.


Control
Returns the current state of the ajax button created in the action bar.
sc_actionbar_disable ("button_name")
Disables the buttons created on the action bar.
sc_actionbar_enable ("boton_nombre")
Enables the buttons created on the action bar.
sc_actionbar_hide ("button_name")
Hides created buttons in the action bar.
sc_actionbar_show ("button_name")
Displays the created buttons on the action bar.
sc_actionbar_state ("button_name", "state_name")
Changes the current state of the button on the action bar.
sc_ajax_javascript ( 'JavascriptMethodName', array("parameter"))
This macro allows the execution of JavaScript methods in form/control events
sc_alert ("Message", $array)
This macro shows a Javascript alert message on the screen.
sc_api_download (profile, settings, file, destination)
This macro is used to download or download files using the Storage APIs.
sc_api_gc_get_obj ($app_name , $json_oauth, $auth_code)
The macro sc_api_gc_get_obj generates the token_code
sc_api_gc_get_url ($app_name, $json_oauth)
This macro generates a URL for user authentication of the google account used for API configuration
sc_api_upload (profile, settings, file, parents)
This macro is used to upload files using the Storage APIs.
sc_apl_conf ("Application", "Property", "Value")
This macro modify the application execution property.
sc_apl_default ("application", "type");
This macro allows that the user defines in your initial application what will happen when the application lost the session.
sc_calc_dv (Digit, Rest, Value, Module, Weights, Type)
This macro calculate verifier digits. (checksums)
sc_call_api ($profile, $arr_settings)
This macro allows us to use as integrated Scriptcase APIs
Dynamically controls the display of captcha in the application.
sc_changed ({Field_Name})
This macro returns "true" if the field name have been changed.
sc_confirm ("Message")
This macro shows a Javascript confirmation screen.
sc_decode ({My_Field})
This macro returns the encrypted field or variable to its original value.
sc_encode ({My_Field})
This macro returns the field or variable with the content encrypted.
sc_error_exit (URL / My_Application, "Target");
Interrupts the method being processed and must be used in conjunction with the "sc_error_message" macro
This macro generates an error message.
sc_exit (Option)
This macro forces the application to exit.
sc_field_no_validate ('field_name')
It ignores the validations defined in the field configuration screen, such as: Required field, character types, among others.
sc_getfield ("myField")
This macro assigns the properties of a field to a javascript variable.
This macro returns the abbreviation of the language being used.
This macro returns the abbreviation of the regional settings being used.
This macro returns the application theme name.
Retrieves the id of the current page, in the transition between the steps of a wizard form.
sc_groupby_label ("My_Field")
This macro dynamically modify the field label displayed in group by lines.
sc_image (Image01.jpg)
This macro loads images passed as parameter to use in the application.
sc_include ("File", "Source")
This macro is used to "include" PHP routines.
sc_include_lib ("Lib1", "Lib2", ...)
This macro is used to dynamically select the application libraries.
sc_include_library ("Target", "Library Name", "File", "include_once", "Require")
This macro includes a PHP file from a library in the application.
sc_label ("field_name")
This macro its used to modify dynamically the grid form field label.
This macro returns the application language
sc_log_add ("action", "description")
This macro will add a record into the log table.
sc_log_split ({description})
This macro returns what was inserted in the "description" field of the log table in an array format.
sc_mail_send (SMTP, Usr, Pw, From, To, Subject, Message, Mens_Type, Copies, Copies_Type, Port, Connection_Type, Attachment, SSL)

This macro is used to send e-mails.

sc_master_value ("Object", "Value")
This macro update a Master Application object from a Detail Application.
sc_redir ('app_name/url', parameter01; parameter02, 'target', 'error', 'modal_height', 'modal_width')
This macro is used to redirect to another application or URL.
This macro can reset sc_apl_default macro settings.
sc_reset_global ([Global_Variable1], [Global_Variable2] ...)
This macro deletes session variables received as a parameter or multiple parameters.
sc_send_mail_api ($arr_settings)

Enables dynamic sending of embedded emails with Mandrill and Amazon SES

sc_send_notification ('title', 'message', 'destiny_type', 'to', 'from', 'link', 'dtexpire', 'profile')
Sends notifications dynamically to the system users.
sc_send_sms ($arr_settings)
This macro is used to send text SMS messages
This macro provide the register sequential number.
sc_set_global ($variable_01) or ({My_Field})

This macro is used to register session variables.

This macro is used to select a specific GROUP BY rule.
sc_set_language ('String Language')
This macro allows us to dynamically change the application language.
sc_set_regional ('String Regional')
This macros allows to dynamically change the application regional settings.
sc_set_theme ('String Theme')
This macro is used to dynamically define the application themes.
This macro verifies if its been used on a safe/secure site. (https protocol)
sc_statistic (arr_val, tp_var)
Calculates and returns an array with statistical values, from an array with numeric values
sc_trunc_num ({My_Field}, Decimal_Number)
This macro its used to set the number of decimals.
This macro modifies the application exit URL.
sc_url_library ("Target", "Library Name", "File")
This macro returns the path of a file, inside a library, to be used on the applications.
sc_warning 'on' or 'off'
This macro dynamically activates or deactivates warning messages control.
sc_webservice ("Method", "URL", "Port", "Send Method", "Parameters Array", "Setting's Array", "Timeout", "Return")
This macro is used to communicate with a web service.
sc_zip_file ("File", "Zip")
This macro is used to generate ZIP files from a file list and/or directories.
Variables - Totalling Totalling Variables
Variables that contains all the totals (general and for grouping).
Variables - Totalling (group by) Totalling Variables (group by)
Breaking totals variables.


Filter
This macro its used to save the where clause content generated through the filter form.


Security
sc_apl_status ("Application", "Status")
This macro Activate/Deactivate the applications at user level.

This macro establishes the connection with the user credentials.

This macro is used to release the connection after using the macro sc_ldap_login

sc_reset_apl_conf ("Application", "Property")
This macro deletes all the modifications effected by "sc_apl_conf" macro.
This macro deletes all the application security status variables.
This macro restores a menu item structure. (removed by the macro "sc_menu_delete").
This macro its used to enable a menu item structure. (disabled by the macro "sc_menu_disable").
sc_user_logout ('variable_name', 'variable_content', 'apl_redir.php', 'target')

Macro used to log the user out to the system.



Shows
sc_ajax_message ("Message", "Title", "Parameters", "Parameters_Redir", "String_toast");
This macro allows the application to display customized messages.
Used to dynamically reload data in grid applications.
sc_block_display (Block_Name, on/off)
This macro dynamically show/hide the fields of a specific block.
sc_change_css ("attribute", "value", "field_name")
Allows manipulating CSS properties of query fields and rows.
sc_field_color ("Field", "Color")
This macro changes the color of a determined field text.
sc_field_disabled ("Field_Name = True/False", "Parameter")

This macro is used to block a field to get any data that would be typed on it.

sc_field_disabled_record ("Field_Name = True/False", "Parametre")
This macro has the objective to block the typing on determined fields in the Forms.
sc_field_display ({My_Field}, on/off)
This macro will display or hide a specific field dynamically.
sc_field_init_off (Field1, Field2,...)
This macro is intended to inhibit the query fields on the initial load.
sc_field_readonly ({Field}, on/off)
This macro dynamically sets a form field attribute to '"Read-Only"
sc_field_style ({My_Field}, "Background-Color", "Size", "Color", "Family", "Weight")
This macro allows to dynamically modify the grid field style.
This macro disables the footer display.
sc_format_num ({My_Field}, "Group_Symb", "Dec_Symb", "Amount_Dec", "Fill_Zeros", "Side_Neg", "Currency_Symb", "Side_Currency_Symb")
This macro its used to format numerical values.
sc_format_num_region ({My_Field}, "Qtde_Dec", "Insert_Zeros", "Monetary_Sym")
This macro has the objective to format numbers, using the regional settings
sc_form_show 'on' or 'off'
This macro dynamically show or hide the form.

This macro provides the name of the Group By rule running at the time.

Inhibits the header display.
sc_hide_groupby_rule ('group1', 'grop2', 'group3')

Macro used to disable Group By rules.

sc_set_focus ('Field')
This macro its used to set the focus to a specific field in a form application.
sc_text_style ({My_Field}, "Background-Color", "Size", "Color", "Family", "Weight")
This macro allows to dynamically modify the text style of a grid field.


Buttons
This macro returns "true" when the "copy" button is selected in a form.
This macro returns "true" when the "Delete" button is selected in a form.
sc_btn_disabled ("name_button", "status")
It is intended to dynamically enable or disable a toolbar button.
sc_btn_display ("Button_Name","on/off")
This macro shows and hides buttons on the toolbar in execution time.
This macro returns "true" when the "Add" button is selected in a form.
sc_btn_label ("btn_name", "new_label")
This macro is used to change the label of the buttons.
This macro returns "true" when the "Add New" button is selected in a form.
This macro returns "true" when the "Save" button is selected in a form.


PDF
sc_set_export_name ("export_type", "file_name")
Changes the name of files exported by the query
Variables - Authentication Authentication Variables
User/Password for the WEB server.


Menu
sc_appmenu_add_item ("Menu_Name", "Id_Item", "Id_Parent", "Label", "Aplication", "Parameters", "Icon", "Hint", "Target")
This Macro adds an item to the menu dynamically.
sc_appmenu_create ("Menu_Name")
This macro dynamically creates a menu item.
sc_appmenu_exist_item ("Menu_Name", "Id_Item")
This macro checks if there is a menu item.
sc_appmenu_remove_item ("Menu_Name", "Id_Item")
This macro dynamically removes a menu item.
sc_appmenu_reset ("Menu_Name")
This macro reset the array used in the dinamically creation of a menu application.
sc_appmenu_update_item ("Menu_Name", "Id_Item", "Id_Parent", "Label", "Aplication", "Parameters", "Icon", "Hint", "Target")
This macro updates a menu item.
sc_btn_disable ('button_id', 'on/off')

This macro is used to disable Menu buttons.

sc_menu_delete (Id_Item1)
This macro remove items of the menu structure.
sc_menu_disable (Id_Item1)
This macro deactivates menu structure items.

This macro is used to force the creation of menus to mobile devices.

This macro identifies the menu item selected.

This macro identifies the application name that was selected in the menu.





sc_actionbar_clicked_state()

The sc_actionbar_clicked_state() macro allows the developer to retrieve the current state of an action bar button at the moment of the click.
This way, it is possible to validate the current state of the button and, based on the system's business rules, change it as necessary.

This macro is exclusive to AJAX events of action bar buttons.

Examples


Example: Identification of the current state of the button in the ajax event, to change the state when clicking.

if (sc_actionbar_clicked_state() == 'pending') {

sc_actionbar_state('ajax_btn', 'sent');


} else {

sc_actionbar_state('ajax_btn', 'pending');

}

 

Example: Example for viewing the current value of the button.

echo sc_actionbar_clicked_state();
 

Macro Scope

Grid application
onClick



sc_actionbar_disable("button_name")

Disables the action bar button, making it unavailable for clicking.

This macro can be used for any type of button (link or ajax) on the action bar.

Parameter definition

Parameter Syntax Description
button_name

It is not possible to use variables, the name of the button must be informed using double quotes or single quotes.

Example
sc_actionbar_disable("ajax_btn");

This parameter is mandatory.

We must inform the name of the action bar button that will be disabled.

 

 

Examples


 

Example 1: Basic macro usage

sc_actionbar_disable("link_detalhe");

 

Example 2: Disabling the link button to the order detail if there are no items in the order.

// Example created in the onRecord event of the grid using the order and orderdetail table
// If there are no items in the order, the button will be disabled

$query = "SELECT count(*) FROM OrderDetails WHERE OrderID = ". {OrderID}; sc_lookup(ds, $query); if ({ds[0][0]} == 0) {

//Exemplo de utilização da macro sc_actionbar_disable sc_actionbar_disable("button_name");

} else {

sc_actionbar_enable("button_name");

}

Macro Scope

Grid application
onClick
onRecord



sc_actionbar_enable("boton_nombre")

Enables the action bar button, making it available for clicking.

This macro can be used for any type of button (link or ajax) on the action bar.

Parameter definition

Parameter Syntax Description
button_name

It is not possible to use variables, the name of the button must be informed using double quotes or single quotes

 

Example
sc_actionbar_enable("ajax_btn");

This parameter is mandatory.

We must inform the name of the action bar button that will be enabled.

 

 

Examples


 

Example 1: Basic macro usage

sc_actionbar_enable("button_name");

 

Example 2: Enabling the link button to the order detail if there is any record to be displayed.

// Example created in the onRecord event of the grid using the order table and orderdetail table
// If there are no items ordered in the measurement, the button will be disabled

$query = "SELECT count(*) FROM OrderDetails WHERE OrderID =" . {OrderID}; sc_lookup(ds, $query); if ({ds[0][0]} <> 0) { //Example of using the sc_actionbar_enable macro sc_actionbar_enable("button_name"); } else {

sc_actionbar_disable("button_name");
}
 

Macro Scope

Grid application
onClick
onRecord



sc_actionbar_hide("button_name")

This macro hides the button created on the action bar, which can be displayed again with the sc_actionbar_show macro.

This macro can be used with any type of button (link or ajax) created in the action bar.

Parameter definition

Parameter Syntax Description
button_name

It is not possible to use variables. The button name must be informed using double quotes or single quotes.

 

Example
sc_actionbar_hide("ajax_btn");

This parameter is mandatory.

We must inform the name of the action bar button that must be hidden.

 

Exemplos


 

Example 1: Basic macro usage

sc_actionbar_show("button_name");

 

Example 2: Showing the order detail link button if there are any records to show.

// Example created in the onRecord event of the query using the order and orderdetail table
// If there are no items in the order, the detail link button will be hidden.

$query = "SELECT count(*) FROM OrderDetails WHERE OrderID =" . {OrderID};
sc_lookup(ds, $query);

if ({ds[0][0]} == 0) {

     //Example of using the macro sc_actionbar_hide
     sc_actionbar_hide("button_name");

} else {

     sc_actionbar_show("button_name");

}

Macro Scope

Grid application
onClick
onRecord



sc_actionbar_show("button_name")

This macro displays the action bar button, hidden using the sc_actionbar_hide macro

This macro can be used for any type of button (link or ajax) on the action bar.

Parameter definition

Parameter Syntax Description
button_name

It is not possible to use variables. The button name must be informed using double quotes or single quotes.

 

Example
sc_actionbar_show("ajax_btn");

This parameter is mandatory.

We must inform the name of the action bar button that will be displayed.

 

Exemplos


 

Example 1: Basic macro usage

sc_actionbar_show("button_name");

 

Example 2: Showing the order detail link button if there are any records to show.

// Example created in the onRecord event of the query using the order and orderdetail table
// If there are no items in the order, the button will not be displayed

$query = "SELECT count(*) FROM OrderDetails WHERE OrderID =" . {OrderID}; sc_lookup(ds, $query); if ({ds[0][0]} <> 0) {
//Exemplo de utilização da macro sc_actionbar_enable sc_actionbar_show("button_name"); } else { sc_actionbar_hide("button_name"); }

Macro Scope

Grid application
onClick
onRecord



sc_actionbar_state("button_name", "state_name")

This macro allows you to change the current state of the action bar button through.

To use the button's, ajax event, we recommend using this macro together with sc_actionbar_clicked_state(); that makes it possible to recover the current state of the button.

Definition of Parameters

Parameters Type Values Description
button_name string

The button name must be informed using double quotes or single quotes.

Example

In bold, you can see the example of how the parameter button_name must be informed:

sc_actionbar_state("ajax_btn", "sent");

This is a mandatory parameter. 

You need inform the name of the button created on the action bar.

state_name string

The state name must be informed using double quotes or single quotes.

Example

In bold, you can see the example of how the parameter state_name must be informed:

sc_actionbar_state("ajax_btn", "sent");

This is a mandatory parameter. 

You need inform the name of the next state that the button will assume.

Examples


Example - Changing the ajax_btn button state between pending and sent in the button's onclick event.

if (sc_actionbar_clicked_state() == 'pending') {
sc_actionbar_state('ajax_btn', 'sent'); } else { sc_actionbar_state('ajax_btn', 'pending');
}

Example - Changing the state of the ajax_btn button between pending and sent, and storing the change in the base in the email_sent field.

if (sc_actionbar_clicked_state() == 'pending') {

	$update = "update orders set email_sent = 'S' WHERE orderid =". {orderid};
sc_exec_sql($update); sc_actionbar_state('ajax_btn', 'sent');
} else { $update = "update orders set email_sent = 'N' WHERE orderid =". {orderid};
sc_exec_sql($update); sc_actionbar_state('ajax_btn', 'pending');
}

Example - Display of the state of the ajax_btn button according to the value stored in the email_sent ield in the onRecord event of the Grid application.

if ({email_sent} == 'S') {

    sc_actionbar_state('ajax_btn', 'sent');
} else { sc_actionbar_state('ajax_btn', 'pending');
}

Macro Scope

Grid application
onClick
onRecord



sc_ajax_javascript( 'JavascriptMethodName', array("parameter"))

This macro allows the execution of JavaScript methods called from some events from form, control, and calendar applications.

To use this macro you need to create a javascript method in the Programming settings.


This macro receives two parameters:

The firs parameter (required) receive the javascript method name.
The second (optional) receive an array with the method parameters on it.


Examples:

Ex. 1: Method javascript without parameters:
sc_ajax_javascript('method_name');
sc_ajax_javascript('sum');

Ex. 2: Method javascript with a parameter:
sc_ajax_javascript('method_name', array("parameter"));


Ex. 3: Method javascript with two parameters:
sc_ajax_javascript('method_name', array("param1","param2"));

Example using global variables:
sc_ajax_javascript('sum', array([num1],[num2]));


Macro Scope

calendar application Form application Control Form
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onValidate
onValidateFailure
onValidateSuccess
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onValidateFailure



sc_ajax_message("Message", "Title", "Parameters", "Parameters_Redir", "String_toast");

This macro allows the application to show customizable messages. Its use is restricted to AJAX events of Form/Control applications.

 

This macro is only available in applications with AJAX support.

 

Parameters Description
Message The message to be shown. This parameter is required.
Title Messagebox title, if this parameter is empty, the title will not be shown.
Message Parameters String

Message format parameters.
Ex.: modal=Y&button=Y&button_label=Ok&redir=form_employees.php&redir_target=_blank

For more details about this parameter, see Table2.

Redirecting Parameters String

In this section is possible to define values for the redirecting target application. This parameter works only if a "redir" property was informed. The properties for this parameter must be informed in this format: parameter=value;parameter=value.

Ex.: customer_id=ALFKI;customer_name=ALBERT FRANCINET

Toast parameter string

Message formatting parameter using Toast.

- toast: Y or N
 
- toast_pos: 'top', 'top-start', 'top-end', 'center', 'center-start', 'center-end', 'bottom', 'bottom-start', 'bottom-end'
 
- type: 'warning', 'error', 'success', 'info', 'question'

 

Table2: Message Parameters String

 

Property Description Values Example
modal Flag to define if the message will be shown in modal Y or N modal=Y
timeout Time in seconds to hide the message. If this property is not informed, the message will be shown indefinitely. This property works only if "button" property is not enabled. Seconds timeout=5
button Shows a button inside the message. This button default function is to close the message. If there is redirecting enabled, the application will be redirected after closing the message. Y or N button=Y
button_label Button label. This option works only if the "button" property is enabled. String button=Y&button_label=OK
top Message positioning value in pixels from top margin. Pixels Number top=300
left Message positioning value in pixels from left margin. Pixels Number left=200
width Messagebox width value in pixels Pixels Number width=320
height Messagebox height value in pixels Pixels Number height=30
redir URL or application name for redirecting. This macro works only if the "button" property is enabled. String button=Y&redir=form_employees.php
redir_target Target for redirecting. This property works only when the "redir" property is enabled. String redir=form_employees.php&redir_target=_blank
show_close Flag for exhibition of the "close" button on the messagebox title bar. When activated, this parameter forces a title bar to be shown, even if there is no title defined. Y or N show_close=Y
body_icon Flag for exhibiting a icon on the message body. The icon exhibition depends on the applications theme configuration (exhibition schemes). Y or N body_icon=N

 

Example 01

sc_ajax_message ("Message", "Title", "timeout=0");

 

Example 02: Using Toast

sc_ajax_message ("Client", "Title", "toast=Y&toasto_pos=center-start&type=success");

 

To display the message using Toast, this option must be enabled in the application interface.


Macro Scope

calendar application Grid application Form application Control Form
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onClick ajaxFieldonBlur
Onchange
OnClick
OnFocus
onBlur
onChange
onClick
onFocus



sc_ajax_refresh

The sc_ajax_refresh() macro is used to reload the data in a grid application without the need to refresh the entire page.

Its use is exclusive to AJAX events in the grid, whether in the onClick event of a field or in the action bar.

Example of use

$upd = "UPDATE order SET status = 'completed' WHERE id =". {orderid};
sc_exec_sql($upd);
// Now the macro will be used to refresh the application's data.
sc_ajax_refresh();

Macro Scope

Grid application
onClick



sc_alert("Message", $array)

This macro sends a message in the alert style of Javascript (Sweetalert) or Sweetalert2.

Ps  

To display the message using a sweetalert2 library, the Use SweetAlert option must be enabled in the application where the macro will be used.  

This option can be enabled in the application's configuration menu. To access the click on: Application> Configuration the option is in the Notification Settings block

Check below the parameters supported by the macro:

  • Message: Mandatory parameter that contains the message that will be displayed.
  • $array: This parameter is optional when using the macro, more mandatory when we want to use Sweetalert2.
    When used, it expects to receive an array with Sweetalert2's settings.

Check the list of configurations accepted by Sweetalert2 in this macro:

 

Parameter Value Description
title Example of how it should be informed within the array: 'title' => 'Título' Text that will be displayed in the card title, if the toast option is marked as false. 'toast' => false
type

Example of how it should be informed within the array: 'type' => 'warning'

List of accepted options:

  • success
  • error
  • warning
  • info
Defines the type of message that will be displayed.
timer Example of how it should be informed within the array: 'timer' => '2000' Defines the time in milliseconds that the message will be displayed.
showConfirmButton

Example of how it should be informed within the array: 'showConfirmButton' => false

List of accepted options:

  • True: Exibe o botão de confirmação.
  • false: Não exibe o botão de confirmação.
Defines whether a confirmation button is displayed.
position

Example of how it should be informed within the array: 'position' => 'bottom-end',

List of accepted options:

  • top
  • top-start
  • top-end
  • center
  • center-start
  • center-end
  • bottom
  • bottom-start
  • bottom-end
Defines the position where the pop-up will be displayed.
toast Example of how it should be informed within the array: 'toast' => true Defines whether or not we will use toast to display messages. When enabled, this option does not display the confirmation button.

Check below the examples of use of the macro:

E.g.: Message using Sweetalert
sc_alert("This is an alert message!!");

 

E.g.: Message using Sweetalert2

$params = array(
'title' => 'Title',
'type' => 'success',
'timer' => '2000',
'showConfirmButton' => false,
'position' => 'bottom-end',
'toast' => true
);

sc_alert("Inserted successfully!", $params);

 


Macro Scope

Blank application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu
onExecute onApplicationInit
onFooter
onHeader
onScriptInit
onFooter
onHeader
onScriptInit
onNavigate
onRecord
onApplicationInit
onFilterInit
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onLoad onApplicationInit
onExecute
onLoad



sc_api_download(profile, settings, file, destination)

This macro is used to download the files stored in the Storage services available in Scriptcase, they are: Google Drive, DropBox and Amazon S3.

First of all, it is necessary to create the keys to use these APIs, either for use with the macro or through the tool interface.

See below for how to obtain the credentials for each of them.

See the list of parameters below.

Parameters Value Description
profile

Example of how the parameter should be informed.

'profile' => 'profile_name',

This parameter accepts only the name of the profile created.

Click here, to see how to create a profile.

We must inform the name of the profile creating in the APIs option in the Tools menu.

When used, this parameter loads the settings informed when the profile is created.

When used, the settings parameter does not need to be informed.

For more details see Using the macro with profile

settings

Example of how the parameter should be informed. 

'settings' => [
'app_name' => 'scriptcase',
'gateway' => 'dropbox',
'api_key' => '',
'api_secret' => '',
'access_token' => '',
],

Note: For more information about the parameter, see the exclusive settings table below, for each of the APIs

It receives an array with the access credentials for the API that will be used.

When used, the profile parameter does not need to be entered.

file

Example of how the parameter should be informed. 

'file' => {image_file_name},

Allowed options: 

  • {image_file_name}
  • [global_variable]
  • ‘File path’

This parameter receives the full path until the file is located.

When using a field, it must be the upload nome do file type.

destination

Example of how the parameter should be informed. 

Using a field
'parents' => {field_name},

Informando uma String
'parents' => ‘folder_name’,

Allowed options:

  • {field_name}
  • [global_variable]
  • ‘Folder name or local cloud storage path’

Directory where the file will be stored

When not informed, the file will be stored at the root of the storage server.

Using the macro with profile

The use of the macro with a profile requires the prior creation of the same.

Click here to see how to create a profile on each of the available storage APIs.

The profile contains the data to use the desired API, thus, when using a profile in the macro, it is not necessary to use the settings parameter.

The profile parameter accepts only the name of the profile created, for the dynamic use of the macro, it will be necessary to use the settings parameters.

Example of using the macro with the profile.

sc_api_download([
'profile' => 'myApi',
'file' => {file},
'destination' => {destination},
]);

Using the macro with settings parameter

The array with the access credentials that must be passed in the settings parameter varies according to the API used.

See below how to use this parameter according to each of the available APIs.

When using the settings parameter in the configuration in the macro, it is not necessary to inform a profile.

Using The Macro With Settings - Google Drive API

First, we must have the credentials for using the Google Drive API in hand, click here to learn how to obtain them.

After configuring the credentials, see below all the values of the array that must be passed in the settings parameter using the Google Drive API.

All values below are mandatory when using the settings parameter

Index Value Description
app_name

Example of how the parameter should be informed.

'app_name' => 'scriptcase',

This index accepts only string

App name entered when creating access credentials.

 

gateway

Example of how the parameter should be informed.

'gateway'  => 'google_driver',

This index accepts only string

Gateway name to identify the API used.

 

json_oauth

Example of how the parameter should be informed.

'json_oauth'  => 'JSON_code',

Allowed options:

  • ‘string’
  • {field_name}
  • $variable

Receives the contents of the user generated authentication (JSON) file.

This file must be downloaded after creating the credentials on the google website.

auth_code

Example of how the parameter should be informed.

'auth_code'  => '5/4wHt7TBTY4MtvQ',

Allowed options:

  • {field_name}
  • $variable

Receives the auth_code code, generated after configuring the API following the steps described in the tutorial 

How to generate the auth_code for using the Google Driver API

token_code

Example of how the parameter should be informed.

'token_code'  => '4/4wHt7TBTY4MtvQ',

Allowed options:

  • ‘string’
  • {field_name}
  • $variable
It is possible to generate the token_code using our sc_api_gc_get_obj macro


Examples when using the macro in Google Drive implementing the parameter settings 

sc_api_download([
  'settings' => [
  'app_name' => {appname},
  'gateway' => 'google_drive',
  'json_oauth' => {jsonoauth},
  'auth_code' => {authcode},
  'token_code' => {tokencode},
  ],
'file' => {files},
'destination' => {destination},
]);

 

Using A Macro With Settings - Dropbox

First, we must have the credentials for using the Google Drive API in hand, click here to learn how to obtain them.

After configuring the credentials, see below all the values of the array that must be passed in the settings parameter using the Dropbox API.

All values below are mandatory when using the settings parameter

Index Value Description
app_name

Example of how the parameter should be informed.

'app_name' => 'scriptcase',

This index accepts only string

App name entered when creating access credentials.

gateway

Exemplo de como o parâmetro deve ser informado.

'gateway'  => 'google_driver',

This index accepts only string

Gateway name to identify the API used.

api_key

Example of how the parameter should be informed.

'api_key’  => {field_name},

Allowed options:

  • ‘string’
  • {field_name}
  • $variable

Receives the app key, generated after configuring the API.

api_secret

Example of how the parameter should be informed.

'api_secret’  => {field_name},

Allowed options:

  • ‘string’
  • {field_name}
  • $variable

Receives the app secret, generated after configuring the API.


Examples when using the macro in Dropbox implementing the parameter settings
 

sc_api_download([
'settings' => [

'gateway' => 'dropbox',
'api_key' => {apikey},
'api_secret' => {apisecret},
'access_token' => {accesstoken},
],
'file' => {file},
'destination' => {destination},
]);

 

Using The Macro With Settings - Amazon S3

First, we must have the credentials for using the Amazon S3 STORAGE API in hand, click here to learn how to obtain them.

After configuring the credentials, see below all the values of the array that must be passed in the settings parameter using the Amazon S3 API.

All values below are mandatory when using the settings parameter]

Index Value Description
app_name

Example of how the parameter should be informed.

'app_name' => 'scriptcase',

This index accepts only string

App name entered when creating access credentials.

gateway

Example of how the parameter should be informed.

'gateway'  => 'google_driver',

This index accepts only string

Gateway name to identify the API used.

api_key

Example of how the parameter should be informed.

'api_key’  => {nome_campo},

Allowed options:

  • ‘string’
  • {field_name}
  • $variable

Receives the api key, generated after configuring the API.

api_secret

Example of how the parameter should be informed.

'api_secret’  => {nome_campo},

Allowed options:

  • ‘string’
  • {field_name}
  • $variable

Receives the api secret, generated after configuring the API.

region

Example of how the parameter should be informed.

'region'  => 'us-east-1',

The region parameter of the macro accepts only the region code.

To make it easier, follow a link to check the code for each region.

https://docs.aws.amazon.com/general/latest/gr/rande.html

Receives the region code, the same used in the creation of credentials.

bucket

Example of how the parameter should be informed.

'bucket'  => 'bucket_name',

Allowed options:

  • ‘string’
  • {field_name}
  • $variable

Receives the Bucket Name, generated after configuring the API.

Examples when using the macro in Amazon S3 implementing the parameter settings 

sc_api_download([
'settings' => [
'app_name' => 'scriptcase',
  'gateway' => 'S3',
  'api_key' => {apikey},
  'api_secret' => {apisecret},
  'region' => {api_region},
  'bucket' => {api_bucket},
  ],
'file' => {file},
'destination' => {destination},
]);

Macro Scope

Grid application Form application
onRecord onLoad
onLoadRecord



sc_api_gc_get_obj($app_name , $json_oauth, $auth_code)
The sc_api_gc_get_obj macro generates the token_code.
It has three parameters:
  1. app_name - Receive the app_name, available in your api configuration. This parameter accepts strings or variable.
  2. json_oauth - Receives the content of the json file, this file is available for download in your API settings. This parameter accepts strings or variable.
  3. auth_code - Receives the auth_code generated in the previous step or another valid auth_code that you have already generated.

For more usage and example information visit our knowledge base article: How to generate the auth code and token code


Macro Scope

calendar application Grid application Search application Form application Control Form Menu application
onApplicationInit
onScriptInit
onScriptInit onFilterInit onScriptInit onApplicationInit
onScriptInit
onApplicationInit



sc_api_gc_get_url($app_name, $json_oauth)
The sc_api_gc_get_url macro generates a URL for google account user authentication used for API configuration.
It has two parameters:
  1. app_name - Receive the app_name, available in your api configuration. This parameter accepts strings or variable.
  2. json_oauth - Receive the content of the json file, this file is available for download in your api settings. This parameter accepts strings or variable.

For more usage and example information visit our knowledge base article: How to generate the auth code and token code


Macro Scope

calendar application Form application Control Form Menu application ReportPDF application
onApplicationInit
onScriptInit
onScriptInit onScriptInit onApplicationInit onApplicationInit



sc_api_upload(profile, settings, file, parents)

This macro is used to upload files to the cloud using the Google, Amazon and DropBox Storage APIs.

First of all, it is necessary to create the keys for using the API, either with the macro or in the fields interface.

After obtaining the credentials, proceed with the macro configuration.

See the list of parameters below.

Parameters Value Description
profile

Example of how the parameter should be informed.

'profile' => 'profile_name',

This parameter accepts only the name of the profile created.

Click here, to see how to create a profile.

We must inform the name of the profile creating in the APIs option in the Tools menu.

When used, this parameter loads the settings informed when the profile is created.

When used, the settings parameter does not need to be informed.

For more details see Using the macro with profile

settings

Example of how the parameter should be informed. 

'settings' => [
'app_name' => 'scriptcase',
'gateway' => 'dropbox',
'api_key' => '',
'api_secret' => '',
'access_token' => '',
],

Note: For more information about the parameter, see the exclusive settings table below, for each of the APIs

It receives an array with the access credentials for the API that will be used.

When used, the profile parameter does not need to be entered.

file

Example of how the parameter should be informed. 

'file' => {image_file_name},

Allowed options: 

  • {image_file_name}
  • [global_variable]
  • ‘File path’

This parameter receives the full path until the file is located.

When using a field, it must be the upload nome do file type.

parents

Example of how the parameter should be informed. 

Using a field
'parents' => {field_name},

Informando uma String
'parents' => ‘folder_name’,

Allowed options:

  • {field_name}
  • [global_variable]
  • ‘Folder name or local cloud storage path’

Directory where the file will be stored

When not informed, the file will be stored at the root of the storage server.


As seen above, the settings parameter receives an array with the access credentials for the API used.

This parameter should be used only when we have not defined a profile in the Tools> API menu

Each API has its own settings for the settings parameter, see below how each should be configured. 

 

Using the macro with profile

The use of the macro with a profile requires the prior creation of the same.

Click here to see how to create a profile on each of the available storage APIs.

The profile contains the data to use the desired API, thus, when using a profile in the macro, it is not necessary to use the settings parameter.

The profile parameter accepts only the name of the profile created, for the dynamic use of the macro, it will be necessary to use the settings parameters.

Example of using the macro with the profile.

sc_api_upload([
   'profile' => 'profile_name',
   'file' => {file},
   'parents' => 'folder_name',
]);

 

Using the macro with settings parameter

The array with the access credentials that must be passed in the settings parameter varies according to the API used.

See below how to use this parameter according to each of the available APIs.

When using the settings parameter in the configuration in the macro, it is not necessary to inform a profile.

 

Using the macro with settings - Google Drive API

First, we must have the credentials for using the Google Drive API in hand, click here to learn how to obtain them.

After configuring the credentials, see below all the values of the array that must be passed in the settings parameter using the Google Drive API.

All values below are mandatory when using the settings parameter

Index Value Description
app_name

Example of how the parameter should be informed.

'app_name' => 'scriptcase',

This index accepts only string

App name entered when creating access credentials.
gateway

Example of how the parameter should be informed.

'gateway'  => 'google_driver',

This index accepts only string

Gateway name to identify the API used.
json_oauth

Example of how the parameter should be informed.

'json_oauth'  => 'JSON_code',

Allowed options:

  • ‘string’
  • {field_name}
  • $variable

Receives the contents of the user generated authentication (JSON) file.

This file must be downloaded after creating the credentials on the google website.

auth_code

Example of how the parameter should be informed.

'auth_code'  => '5/4wHt7TBTY4MtvQ',

Allowed options:

  • {field_name}
  • $variable

Receives the auth_code code, generated after configuring the API following the steps described in the tutorial 

How to generate the auth_code for using the Google Driver API

token_code

Example of how the parameter should be informed.

'token_code'  => '4/4wHt7TBTY4MtvQ',

Allowed options:

  • ‘string’
  • {field_name}
  • $variable
It is possible to generate the token_code using our sc_api_gc_get_obj macro


Examples when using the macro in Google Drive implementing the parameter settings 

sc_api_upload([
   'settings' => [
       'app_name' => 'scriptcase',
       'gateway' => 'google_drive',
       'json_oauth' => '',
       'auth_code' => '',
       'token_code' => '',
   ],
   'file' => {file},
   'parents' => '',
]);

 

Using a macro with settings - Dropbox

First, we must have the credentials for using the Google Drive API in hand, click here to learn how to obtain them.

After configuring the credentials, see below all the values of the array that must be passed in the settings parameter using the Dropbox API.

All values below are mandatory when using the settings parameter

Index Value Description
app_name

Example of how the parameter should be informed.

'app_name' => 'scriptcase',

This index accepts only string

App name entered when creating access credentials.
gateway

Exemplo de como o parâmetro deve ser informado.

'gateway'  => 'google_driver',

This index accepts only string

Gateway name to identify the API used.
api_key

Example of how the parameter should be informed.

'api_key’  => {field_name},

Allowed options:

  • ‘string’
  • {field_name}
  • $variable
Receives the app key, generated after configuring the API.
api_secret

Example of how the parameter should be informed.

'api_secret’  => {field_name},

Allowed options:

  • ‘string’
  • {field_name}
  • $variable
Receives the app secret, generated after configuring the API.


Examples when using the macro in Dropbox implementing the parameter settings
 

sc_api_upload([
   'settings' => [
       'app_name' => 'scriptcase',
       'gateway' => 'dropbox',
       'api_key' => '',
       'api_secret' => '',
       'access_token' => '',
   ],
   'file' => {file},
   'parents' => '',
]);

 

Using the macro with settings - Amazon S3

First, we must have the credentials for using the Amazon S3 STORAGE API in hand, click here to learn how to obtain them.

After configuring the credentials, see below all the values of the array that must be passed in the settings parameter using the Amazon S3 API.

All values below are mandatory when using the settings parameter

Index Value Description
app_name

Example of how the parameter should be informed.

'app_name' => 'scriptcase',

This index accepts only string

App name entered when creating access credentials.
gateway

Example of how the parameter should be informed.

'gateway'  => 'google_driver',

This index accepts only string

Gateway name to identify the API used.
api_key

Example of how the parameter should be informed.

'api_key’  => {nome_campo},

Allowed options:

  • ‘string’
  • {field_name}
  • $variable
Receives the api key, generated after configuring the API.
api_secret

Example of how the parameter should be informed.

'api_secret’  => {nome_campo},

Allowed options:

  • ‘string’
  • {field_name}
  • $variable
Receives the api secret, generated after configuring the API.
region

Example of how the parameter should be informed.

'region'  => 'us-east-1',

The region parameter of the macro accepts only the region code.

To make it easier, follow a link to check the code for each region.

https://docs.aws.amazon.com/general/latest/gr/rande.html

Receives the region code, the same used in the creation of credentials
bucket

Example of how the parameter should be informed.

'bucket'  => 'bucket_name',

Allowed options:

  • ‘string’
  • {field_name}
  • $variable
Receives the Bucket Name, generated after configuring the API.

 

Examples when using the macro in Amazon S3 implementing the parameter settings 

sc_api_upload([
   'settings' => [
       'app_name' => 'scriptcase',
       'gateway'  => 'S3',
       'api_key' => '',
       'api_secret' => '',
       'region' => '',
       'bucket' => '',
   ],
   'file' => {file},
   'parents' => '',
]);

Macro Scope

Form application Control Form
onAfterDelete
onAfterUpdateAll
onBeforeInsertAll
onValidate
onValidate



sc_apl_conf("Application", "Property", "Value")

This macro allows modifying the property of the application. The user can determine if a Form will start in insert mode, or a Grid starts by the filter, etc.

This macro must be used by one application to modify the properties of another application.


Properties for Form applications

Property Value Description
start new Forces the form to start in the insert mode in order to add new records.
insert on/off Qualifies (on) or unqualifies (off) the "add new" button to allow the addition of new records.
update on/off Qualifies (on) or unqualifies (off) the "save" button on the form.
delete on/off Qualifies (on) or unqualifies (off) the "delete" button on the form.
field_display_off field Dynamically hides a field.
field_display_on field Dynamically shows a field.
field_readonly field Dynamically set the "read-only" attribute in order to select the field.
rows   Forces the number of lines for each page (only for the form of multiple records).
rows_ins   Forces the number of lines for insert (only for the form of multiple records).


Property for Grid applications

Property Value Description
start filter Forces the Grid to start by the filter.
cols   Forces the number of columns. (vertical and slide kind)
rows   Forces the number of lines per page.
lig_edit on/off Qualifies (on) or unqualifies (off) the record edition. (the pencil icon)

 

Property for all applications

Property Value Description
exit apl/URL Forces application to exit to a specified location.

 

Ex. 1: Forces the "my_form" application to start in the addition mode.
sc_apl_conf("my_form", "start", "new");

 

Ex. 2: Doesn't allow the "my_form" application make addition of new registers.
sc_apl_conf("my_form", "add", "off");

 

Ex. 3: Sets "my_field" on the application "my_form" (readonly attribute) to "true" dinamically.
sc_apl_conf("my_form", "field_display_off", "my_field");

 

Ex. 4: Shows "my_field" on the application "my_form" dinamically.
sc_apl_conf("my_form", "field_display_on", "my_field");

 

Ex. 5: Forces the "my_grid" application to start by filter.
sc_apl_conf("my_grid", "start", "filter");

 

Ex. 6: Forces the "my_grid" application to show 20 lines.
sc_apl_conf("my_grid", "rows", "20");

 

Ex. 7: Hides "my_field" on the application "my_form" dinamically.
sc_apl_conf("my_form", "field_display_off", "my_field");

Ex. 8: Use the button on the toolbar menu.
if ({sc_menu_item} == "btn_1")
{
sc_apl_conf("form_customer", "start", "new");
}

 


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onFilterInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onScriptInit



sc_apl_default("application", "type");

This macro allows that the user defines in your initial application what will happen when the application lost the session.

The macro has the following parameters:

Apl: Here it is necessary to inform which application the macro will redirect after lost the session.

Type: Here we will inform the redirecting type that will occur. There are two types:

  • R: The application will only redirect to the initial application.
  • M: Will be shown a message before the redirecting.

Example: In a login application defined as the initial application, we can define that this application will redirect to himself.
sc_apl_default("app_login","R")


Macro Scope

calendar application chart application Grid application Search application Form application Control Form ReportPDF application
onCalendarScriptInit
onScriptInit
onScriptInit onScriptInit onFilterInit onScriptInit onScriptInit onScriptInit



sc_apl_status("Application", "Status")

Used to control security access. These macros activate/deactivate the applications that a user has access to.


Application: Is the name or the variable that contains the name of the application to be activated/deactivated.
Status: Is the value or variable that contains the value to be attributed to the application. The values are: "on" to activate and "off" to deactivate.

 

Ex. 1:
sc_apl_status ('atu_cad', 'off');


Ex. 2:
sc_apl_status ({var_name_appl}, {var_status});


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute onApplicationInit
onCalendarApplicationInit
onCalendarScriptInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onFilterInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onScriptInit



sc_appmenu_add_item("Menu_Name", "Id_Item", "Id_Parent", "Label", "Aplication", "Parameters", "Icon", "Hint", "Target")

Adds an item to a menu application dynamically.

It is only possible to use this macro when there is an array created before by the macro sc_appmenu_create.

Parameter Description
Menu_name Application menu name.
Id_item Menu item id.
Id_Parent Parent menu item id. For roots the null/empty value is passed.
Label Menu item description.
Application Menu item URL or application name
Parameters String with parameters to pass to the menu item application.
Ex.: param1=valor;param2=valor
Icon Path to icon used in menu item.
Hint Descriptive hint to menu item.
Target Target for menu item link. ("_self" to use the same window, "_blank" to a new one and "_parent" to exit the window.

 

 

Ex. 1: Creates a menu named menu_main.
sc_appmenu_create('menu_main');


Ex. 2:
Adds a on the menu_main the the item_1 named Category.
sc_appmenu_add_item('menu_main','item_1','','Category','');


Ex. 3: Adds a on the menu_main (item_2) the item_1 name Category linked to the form_category passing a few parameters.
sc_appmenu_add_item('menu_main','item_2','item_1','Category Form','form_category','param1=value;param2=value');


Macro Scope

Menu application Responsive Menu Tree menu
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onLoad



sc_appmenu_create("Menu_Name")

This macro starts or uses an array for a dynamic montage of a menu application. You must be informed or you will not apply the menu as a parameter.

This macro should be used in events of control or not event onload of the menu.

 

Ex. 1:
sc_appmenu_create ('menu_main');


Macro Scope

Menu application Responsive Menu Tree menu
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onLoad



sc_appmenu_exist_item("Menu_Name", "Id_Item")

This macro should be used in events of control or not event onload of the menu.

 

Ex. 1:
sc_appmenu_create ('menu_main');

Check if a menu item exists and return a true or false value.

Parameter Description
Menu_Name Menu App Name
Id_Item Menu Item Identifier Code


Ex. 1:

if(sc_appmenu_exist_item('menu_main', 'item_2')){

sc_appmenu_update_item('menu_main','item_2','item_1','Category Form','form_category');

}
else{

sc_appmenu_add_item('menu_main','item_2','item_1','Category Form','form_category');

}


Macro Scope

Menu application Responsive Menu Tree menu
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onLoad



sc_appmenu_remove_item("Menu_Name", "Id_Item")

This macro dynamically removes a menu item.

To use this macro it is necessary to execute the macro sc_appmenu_create before.

Parameter Description
menu_name Menu application name
id_item Menu item id

 

 

 

 

Ex. 1:
sc_appmenu_remove_item('menu_main','item_2');


Macro Scope

Menu application Responsive Menu Tree menu
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onLoad



sc_appmenu_reset("Menu_Name")

This macro resets the array used in the dynamic creation of a menu application.

This macro is expecting the menu application name as the single parameter.

 

Ex. 1:
sc_appmenu_reset('menu_main');


Macro Scope

Menu application Responsive Menu Tree menu
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onLoad



sc_appmenu_update_item("Menu_Name", "Id_Item", "Id_Parent", "Label", "Aplication", "Parameters", "Icon", "Hint", "Target")

Updates an application menu item dynamically

It is only possible to use this macro when there is an array created before by the macro sc_appmenu_create.

It is only possible to use this macro on items created before by the macro sc_appmenu_add_item.

 

Parameter Description
menu_name Application menu item name
id_item Application menu item id
id_parent Application menu item parent id. For roots, the null/empty value is passed.
Label Application menu item description.
Application Menu item URL or application name
Parameters String with a parameter to pass to the application menu item
Ex.: param1=valor;param2=valor
Icon Icon path used in the menu item.
Hint Descriptive Hint for the menu item.
Target The target for menu item link

 

Ex. 1:
sc_appmenu_update_item('menu_main','item_2','item_1','Category Form','form_category');


Macro Scope

Menu application Responsive Menu Tree menu
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onLoad



sc_begin_trans("Connection")

This macro starts a set of transactions in the database.

For the use of this macro you need to have a transactional database.

In form applications, the events (onAfterInsert, onAfterUpdate, onAfterDelete, onBeforeInsert, onBeforeUpdate or onBeforeDelete) are automatically protected by a transaction control, since the connection is the same of the application.

In the other cases, if the user need to make a transaction control, must begin with this macro and finish with the sc_commit_trans() macro to confirm the updates or sc_rollback_trans() to cancel the transactions.

The "connection" parameter is optional, necessary only if the command is executed in a different connection from the actual application.

Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onFooter
onHeader
onScriptInit
onClick
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onFooter
onHeader
onScriptInit
onRecord



sc_block_display(Block_Name, on/off)

Dynamically determines the display fields of a specific block.

By default, all the blocks are displayed ("on" condition).

 

Ex. 1:
if ({type_customeri} == "personal")
{
sc_block_display(company, off);
}
else
{
sc_block_display(personal, off);
}

Ex 2: Using a local variable as second parameter

$var = "off";

sc_block_display(company, $var);

 

Obs: In grids, this macro only works with "slide" orientation.


Macro Scope

calendar application chart application Grid application Form application Control Form
onAfterInsert
onAfterUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onScriptInit onScriptInit
onRecord
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onClick
onScriptInit
onLoadAll
onRefresh



sc_btn_copy

Available when the "Copy" button is clicked. It can be tested and used inside the ScriptCase events, allowing specific programming in run time.

 

Ex. 1:

if (sc_btn_copy)

{

sc_message("Record copied successfully!");

}


Macro Scope

calendar application Form application
onScriptInit
onLoad
onScriptInit
onLoad



sc_btn_delete

Available when the "Delete" button is clicked. It can be tested and used inside the ScriptCase events, allowing specific programming in run time.

Ex. 1:
if (sc_btn_delete)
{
sc_error_message("Unable to delete this record");
}


Macro Scope

calendar application Form application
onValidate
onValidateFailure
onValidateSuccess
onValidate
onValidateFailure
onValidateSuccess



sc_btn_disable('button_id', 'on/off')

This macro is used to disable or enable buttons from a Menu application.

 

Ex:

sc_btn_disable('btn_2', 'off');


Macro Scope

Menu application Responsive Menu Tree menu
onApplicationInit
onLoad
onApplicationInit
onLoad
onLoad



sc_btn_disabled("name_button", "status")

This macro is intended to dynamically enable or disable a toolbar button.

It has two required parameters:

Parameters Value Description
name_button

The value must be informed using variables or in string format, with double or single quotes.

In bold, the example of how the parameter should be reported follows:

sc_btn_disabled('update', 'off');

Note: The name of the buttons should be all in tiny.

This parameter sets the button that will have its display changed.

Button names are available in the table below, separated by application.

status

Like the field name, the parameter accepts only string, with single or double quotation marks.

In bold, the example of how the parameter should be reported follows:

sc_btn_disabled('update', 'off');

This parameter sets whether the button is enabled, when set to on, or disabled if set to off

Values accepted in the parameter:

  • on - The button will be disabled;
  • off - The button will be enabled;

 


Name of Grid buttons

Buttons Name
Description
first Goes to the first page of the grid.
back Goes to the previous page of the grid.
forward Goes to the next page of the grid.
last Goes to the last page of the grid.
filter Displays the "Filter" button.
pdf Generates colored PDF.
det_pdf Generates a detailed PDF.
pdfbw Generates black and white PDF.
xls Generates the XLS.
xml Generates the XML.
csv Generates the CVS.
rtf Generates the RTF.
word Generates the Word.
json Generates the JSON.
print Displays the "Print" button in the grid.
det_print Displays the "Print" button in detail.
summary Displays the "Summary" button in the grid.
new Displays the "New" button. (if the application has a link for it, or if the form is running in the grid iframe)
insert Displays the "Include" button of the form. (only for forms running in grid´s iframe)
update Displays the "Update" button of the form. (only for forms running in grid´s iframe)
delete Displays the "Delete" button of the form (only for forms running in grid´s iframe)
qsearch Displays the "Quick Search" button in the grid.
dynsearch Displays the "Dynamic Search" button in the grid.
gridsave Displays the "Save Grid" button in the grid.
sel_col Select columns button
sort_col Sort Button

 


Name of Form buttons

Buttons Name
Description
first Goes to the first page of the form.
back Goes to the previous page of the form.
forward Goes to the next page of the form.
last Goes to the last page of the form.
new Displays the "New" button on the form, if it's off the form will starts in insertion mode.
insert Displays the "Include" button of the form.
update Displays the "Update" button of the form.
delete Displays the "Delete" button of the form.
copy Displays the "Copy" button of the form.
pdf Generates PDF file from a form.
print Open the form in print mode.
dynsearch Displays the "Dynamic Search" button in the grid.

 


Name of Control Buttons

Buttons Name
Description
ok Displays the "Ok" button on the control.
exit Displays the "Exit" button on the control.
facebook Displays the "Facebook" button on the control.
twitter Displays the "Twitter" button on the control.
google Displays the "Google+" button on the control.
paypal Displays the "PayPal" button on the control.

 


Example: Enabling delete button only for admin user

if ( [user_login] == 'admin' ) {

    sc_btn_disabled('delete', 'on');

} else {

    sc_btn_disabled('delete', 'off');

}

 

Macro Scope

calendar application chart application Grid application Form application Control Form
onAfterDelete
onAfterInsert
onAfterUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onScriptInit onScriptInit onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onScriptInit
onLoad
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess



sc_btn_display("Button_Name","on/off")

Activate toolbars buttons on the application in execution time.

Button_Name: Is the variable name that contains the name of the button to be activated/deactivated.

 

Buttons Name (Grid):

group displays the "Group By" button in the grid.

Buttons Name
Description
first Goes to the first page of the grid.
back Goes to the previous page of the grid.
forward Goes to the next page of the grid.
last Goes to the last page of the grid.
filter Displays the "Filter" button.
pdf Generates colored PDF.
det_pdf Generates a detailed PDF.
pdfbw Generates black and white PDF.
xls Generates the XLS.
xml Generates the XML.
csv Generates the CVS.
rtf Generates the RTF.
word Generates the Word.
json Generates the JSON.
print Displays the "Print" button in the grid.
det_print Displays the "Print" button in detail.
summary Displays the "Summary" button in the grid.
new Displays the "New" button. (if the application has a link for it, or if the form is running in the grid iframe)
insert Displays the "Include" button of the form. (only for forms running in grid´s iframe)
update Displays the "Update" button of the form. (only for forms running in grid´s iframe)
delete Displays the "Delete" button of the form (only for forms running in grid´s iframe)
qsearch Displays the "Quick Search" button in the grid.
dynsearch Displays the "Dynamic Search" button in the grid.
gridsave Displays the "Save Grid" button in the grid.
sel_col Select columns button
sort_col Sort Button

 

Buttons Name (Form):

Buttons Name
Description
first Goes to the first page of the form.
back Goes to the previous page of the form.
forward Goes to the next page of the form.
last Goes to the last page of the form.
new Displays the "New" button on the form, if it's off the form will starts in insertion mode.
insert Displays the "Include" button of the form.
update Displays the "Update" button of the form.
delete Displays the "Delete" button of the form.
copy Displays the "Copy" button of the form.
qsearch Displays the "Quick Search" button of the form.
pdf Generates PDF file from a form.
print Open the form in print mode.
dynsearch Displays the "Dynamic Search" button in the grid.

 

Buttons Name (Control):

Buttons Name
Description
ok Displays the "Ok" button on the control.
exit Displays the "Exit" button on the control.
facebook Displays the "Facebook" button on the control.
twitter Displays the "Twitter" button on the control.
google Displays the "Google+" button on the control.
paypal Displays the "PayPal" button on the control.

OBS. Remember that the button's name must be lowercase.

 

 

Ex. 1:
sc_btn_display ('new', 'off');

 

Ex. 2: Using a local variable as second paramenter

$var = "off";
sc_btn_display ('new', $var);

 

Ex. 3: If we use variables or fields ({Fields} or [Global_Variables]) as parameters its not allowed the use of the quotes or single quotes.
sc_btn_display ({variavle_button}, 'off');


Macro Scope

calendar application chart application Grid application Form application Control Form
onAfterDelete
onAfterInsert
onAfterUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onScriptInit onScriptInit onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure



sc_btn_insert

Available when the "Add" button is clicked. It can be tested and used inside the ScriptCase events, allowing specific Programmation in run time.

 

Ex. 1:
if (sc_btn_insert)
{
sc_message("Record inserted successfully");

}


Macro Scope

calendar application Form application
onValidate
onValidateFailure
onValidateSuccess
onValidate
onValidateFailure
onValidateSuccess



sc_btn_label("btn_name", "new_label")


This macro is used to dynamically change the label of the buttons, whether they are created by the developer or Scriptcase's own.

For this, it is necessary to inform two mandatory parameters, 'btn_name' and 'new_label'.

 

Parâmetro Valor Descrição
btn_name

The parameter can be entered using variables (Global or Local) or string (Using Double or Single Quotes)

In bold, here is the example of how the parameter should be entered:

sc_btn_label('update', 'Update Record');

Values accepted in the parameter:

  • String - Protected by single or double quotes. Ex.: 'update'
  • Variables - Local or global. E.g.: $btn_update

Receives the name of the buttons that will have the label changed.

Button names, which are automatically created by Scriptcase, are available below, separated by application.

new_label

The parameter can be entered using variables (Global or Local) or string (Using Double or Single Quotes)

sc_btn_label('update', 'Update Record');

Values accepted in the parameter::

  • String - Protected by single or double quotes. E.g.: 'Update Record'
  • Variables - Local or global. E.g.: $new_label
  • Lang -variable lang. E.g.: {lang_btn_label}

This parameter receives the new label of the button informed in the previous parameter.

In addition to string and variable, it is also possible to use a lang to define the label, enabling the translation of your application's internationalization.

 

Click here and see examples of using the macro.


 

Nombre de los botones de cuadrícula

Buttons Name
Description
first Goes to the first page of the grid.
back Goes to the previous page of the grid.
forward Goes to the next page of the grid.
last Goes to the last page of the grid.
filter Displays the "Filter" button.
pdf Generates colored PDF.
det_pdf Generates a detailed PDF.
pdfbw Generates black and white PDF.
xls Generates the XLS.
xml Generates the XML.
csv Generates the CVS.
rtf Generates the RTF.
word Generates the Word.
json Generates the JSON.
print Displays the "Print" button in the grid.
det_print Displays the "Print" button in detail.
summary Displays the "Summary" button in the grid.
new Displays the "New" button. (if the application has a link for it, or if the form is running in the grid iframe)
insert Displays the "Include" button of the form. (only for forms running in grid´s iframe)
update Displays the "Update" button of the form. (only for forms running in grid´s iframe)
delete Displays the "Delete" button of the form (only for forms running in grid´s iframe)
qsearch Displays the "Quick Search" button in the grid.
dynsearch Displays the "Dynamic Search" button in the grid.
gridsave Displays the "Save Grid" button in the grid.
sel_col Select columns button
sort_col Sort Button

 

Name of Form buttons

Buttons Name
Description
first Goes to the first page of the form.
back Goes to the previous page of the form.
forward Goes to the next page of the form.
last Goes to the last page of the form.
new Displays the "New" button on the form, if it's off the form will starts in insertion mode.
insert Displays the "Include" button of the form.
update Displays the "Update" button of the form.
delete Displays the "Delete" button of the form.
copy Displays the "Copy" button of the form.
pdf Generates PDF file from a form.
print Open the form in print mode.
dynsearch Displays the "Dynamic Search" button in the grid.

 

Name of Control Buttons

Buttons Name
Description
ok Displays the "Ok" button on the control.
exit Displays the "Exit" button on the control.
facebook Displays the "Facebook" button on the control.
twitter Displays the "Twitter" button on the control.
google Displays the "Google+" button on the control.
paypal Displays the "PayPal" button on the control.

 


Exemplo: Parameter with string

sc_btn_label('update', 'Atualizar Registro');

 

Example: Parâmetro com lang

sc_btn_label("update", {lang_btn_label});

 

Example:Parameter with Global variable

[btn_name] = "update";
[label] = "update";
sc_btn_label([btn_name], [label]);

 

Example: Parameter with local variable

$btn_name = "update";
$label= "update";
sc_btn_label($btn_name, $label);

 


Macro Scope

calendar application chart application Grid application Form application Control Form
onAfterDelete
onAfterInsert
onAfterUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onScriptInit onScriptInit onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onScriptInit
onLoad
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure



sc_btn_new

Available when the "Add New" button is clicked. It can be tested and used inside the ScriptCase events, allowing specific programming in run time.

 

Ex. 1:
if (sc_btn_new)
{
{My_Date} = date('Y/m/d');
}


Macro Scope

calendar application Form application
onLoad onLoad



sc_btn_update

Available when the "Save" button is clicked. It can be tested and used inside the ScriptCase events, allowing specific programming in run time.

 

Ex. 1:
if (sc_btn_update)
{
sc_error_message("Record updated successfully");
}


Macro Scope

calendar application Form application
onValidate
onValidateFailure
onValidateSuccess
onValidate
onValidateFailure
onValidateSuccess



sc_calc_dv(Digit, Rest, Value, Module, Weights, Type)

Calculate verifier (checksum) digits.

 

Parameter

Description
Digit Variable that will receive the calculated digit.
Rest Variable that will receive the "rest" of the division.
Value Value or Variable to calculate the digit.
Module Value or Variable containing the module to be used. The default value is the module "11".
Weights Value or Variable containing the weights to be used. The default value is the "98765432".
Type Value or Variable containing the parcels calculation to be used: 1 to the normal sum of the values of the parcels and 2 to the sum of each algorithm of the parcels. The default value is "1".

 

Ex. 1:
sc_calc_dv({my_dv}, {my_rest}, 1234567, 11, 98765432, 1);
Parcels calculation: 7x2= 14 ; 6x3=18 ; 5x4=20 ; 4x5=20 ; 3x6=18 ; 2x7=14 ; 1x8=8
Parcels sum : 14 + 18 + 20 + 20 + 18 + 14 + 8 = 112
Rest of the division of 112 / 11 = 2
Digit: 11 - 2 = 9

 

Ex. 2:
sc_calc_dv({my_dv}, {my_rest}, 1234567, 10, 12, 2);
Parcels calculation: 7x2= 14 ; 6x1=6 ; 5x2=10 ; 4x1=4 ; 3x2=6 ; 2x1=2 ; 1x2=2
Parcels sum: 1 + 4 + 6 + 1 + 0 + 4 + 6 + 2 + 2 = 26
Rest of the division of 26 / 10 = 6
Digit: 10 - 6 = 4


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onFooter
onHeader
onScriptInit
onClick
onApplicationInit
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onExecute
onLoad
onApplicationInit
onFooter
onHeader
onScriptInit
onRecord



sc_call_api($profile, $arr_settings)

It allows us to use Scriptcase built-in APIs. We currently offer integration with the Mandrill and Amazon SES APIs.

This macro has two parameters:

Parameters Description
$profile Required parameter. Can be passed empty '' or contain the gateway name configured in "tools> API".
$arr_settings This parameter is optional as long as the "profile" is not empty. When informed, this parameter must contain an Array with the Gateway used and the API key.

 

Example 1 - Parameter $arr_settings, array with the API information

$settings = array( 'settings' => ['gateway' => 'mandrill', 'api_key'=> {api_key}] );

$mandrill = sc_call_api('', $settings);

 

Example 2 - Sending email using mandrill.

$txt_no_tags = strip_tags({msg});

$arr_merge = array(
                 'name'  => '',
                 'type'  => 'to',
                 'email' => 'exemplo@exemplo.com'
             );

$var_config = array( 'settings' => ['gateway' => 'mandrill', 'api_key'=> {api_key}] );

$mandrill = sc_call_api('', $var_config);
$var_msg = array(
               'from_email'                     => {from_email},
               'from_name'                      => {from_name},
                'html'                          => {msg},
                'text'                          => $txt_no_tags,
                'to'                            => array($arr_merge),              
                'subject'                       => {subject},
                'important'                     => true,            
                'auto_text'                     => null,
                'auto_html'                     => null,
                'inline_css'                    => null,
                'metadata'                      => array('website' => 'www.scriptcase.net')
    );

$async = false;
$retorno = $mandrill->messages->send($var_msg, $async);

Example 3 - Sending SMS using clickatell.

$var_config     = array( 
  'message'     => [
    'to'      => {sms_to},
    'message'     => {sms_txt},
    ],
    'settings'    => [
    'gateway'   => {gateway},
    'auth_token'  => {auth_token},
    ] 
);

sc_send_sms($var_config);

Example 4 - Using the macro with PagSeguro

  $arr_settings = [
            'gateway' => 'pagseguro',
            'environment' => 'sandbox',
            'auth_email' => 'exemplo@gmail.com',
            'auth_token' => '72AE21503DDA4840BE1DC7945F6D1CE1'
                 ];
sc_call_api('',$arr_settings);

Example 5 - Using the macro with PayPal

  $arr_settings = [
            'gateway' => 'paypal',
            'environment' => 'sandbox',
            'auth_email' => 'exemplo@gmail.com',
            'auth_token' => '72AE21503DDA4840BE1DC7945F6D1CE1'
                 ];
sc_call_api('',$arr_settings);

Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Tree menu ReportPDF application
onExecute onAfterDelete
onAfterInsert
onAfterUpdate
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onFooter
onHeader
onScriptInit
onClick
onHeader
onScriptInit
onRecord
onFilterInit
onFilterSave
onFilterValidate
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onFooter
onHeader
onScriptInit
onRecord



sc_captcha_display("on/off")

Dynamically controls whether the captcha/recaptcha configured in the application is displayed.

To use the macro, the application must be previously configured with the resource.

Example

if ( $_SERVER['REMOTE_ADDR'] == '127.0.0.1' ) {

    sc_captcha_display("on");

} else {

  sc_captcha_display("off");
 

Macro Scope

Form application Control Form
onScriptInit
onLoad
onScriptInit
onLoadAll



sc_changed({Field_Name})

 

This macro is used to check if the field name has been changed.

Ex. 1:
if (sc_changed({my_field}))
{
Echo "Field have been changed";
}


Macro Scope

calendar application Form application Control Form
onBeforeUpdate
onValidate
onValidateFailure
onValidateSuccess
onBeforeUpdate
onValidate
onValidateFailure
onValidateSuccess
onRefresh



sc_change_connection("Old_Connection", "New_Connection")

This macro dynamically change the application connections

Ex. 1: To change the connections:

sc_change_connection("Old_Concection01", "New_Connection01" ; "Old_Concection02", "New_Connection02");


Allows to change more then one application/connection in one command. Multiple connections can be passed as parameters that must be separated by a ";".

 

Ex. 2: Using variables:

sc_change_connection([Global_Connetion], [Test_Connection]);


The changes take effect in the following applications.

 

Ex. 3: Changing the application main connection

sc_change_connection({Password}, [Test] ; "My_Connection", [Global_Connection]);


The changes take effect in the following applications.

 

Ex. 4: To delete the exchange:

To recover your previous settings you can use the sc_reset_change_connection(); macro


Macro Scope

Blank application calendar application chart application Grid application Form application Control Form ReportPDF application
onExecute onScriptInit
onLoad
onHeader
onScriptInit
onApplicationInit
onScriptInit
onScriptInit
onLoad
onLoadRecord
onScriptInit
onLoadAll
onHeader
onScriptInit
onRecord



sc_change_css("attribute", "value", "field_name")

This macro allows changing CSS attributes of application fields.

 

Parameter List

parameters parameter values Description

attribute_name

The button name must be informed using double quotes, single quotes or variables.

In this parameter is possible to use sc_badge that apply a predefined css in the text. 

Example
In this example we are using the color attribute

sc_change_css('color''#dcfce7');

Required Attribute.

Defines the CSS attribute that will be changed.

value

The button name must be informed using double quotessingle quotes or variables.

When is used  sc_badge  at this parameter the attribute value should be one of the colors above:
blue, brown, cyan, gray, green, orange, pink, purple, red, yellow and empty string 

If the attribute value be empty string, the badge wll be removed

Example
In this parameter we define the value for the CSS attribute it should receive, in the example we are defining the color: #dcfce7

sc_change_css('color', '#dcfce7');

Required Attribute.

Defines the value that the informed attribute will receive

field_name

The button name must be informed using double quotessingle quotes or variables.

Example
In this example we are defining the change in the font color of the field fld_status

sc_change_css('color', '#dcfce7', 'status');

Example with sc_badge
sc_change_css('sc_badge', 'green', 'field_name');

Optional Attribute.

Defines the field where the CSS will be applied, if no value is entered, the change will be made in all fields of the line.

To use sc_badge is necessary to inform the field name, in other hand it will not apply css to any field.  

 

Example


Example of changing the font color and using the attribute sc_badge

switch({taskstatus}) {
	case 'COMPLETED':
		sc_change_css('color', '#dcfce7', 'taskstatus');
		sc_change_css('sc_badge', 'green', 'taskstatus');
		break;
		
	case 'IN-PROGRESS':
		sc_change_css('color', '#1e40af', 'taskstatus');
		sc_change_css('sc_badge', 'blue', 'taskstatus');
		break;
		
	case 'NOT-STARTED':
		sc_change_css('color', '#991b1b', 'taskstatus');
		sc_change_css('sc_badge', 'red', 'taskstatus');
		break;
}
 

Example of the macro with css attribute:

switch({taskstatus}) {
	case 'COMPLETED':
		sc_change_css('color', '#166534', 'taskstatus');
		sc_change_css('background-color', '#dcfce7', 'taskstatus');
		sc_change_css('padding-right', '0.6em', 'taskstatus');
		sc_change_css('padding-left', '0.6em', 'taskstatus');
		sc_change_css('border-radius', '14px', 'taskstatus');
		sc_change_css('font-weight', 'bold', 'taskstatus');
		sc_change_css('width', 'fit-content', 'taskstatus');
		sc_change_css('display', 'block', 'taskstatus');
		sc_change_css('padding-top', '0.2em', 'taskstatus');
		sc_change_css('padding-bottom', '0.2em', 'taskstatus');
		sc_change_css('font-size', '60%', 'taskstatus');
		sc_change_css('margin', '10%', 'taskstatus');
		break;
		
	case 'IN-PROGRESS':
		sc_change_css('color', '#1e40af', 'taskstatus');
		sc_change_css('background-color', '#dbeafe', 'taskstatus');
		sc_change_css('padding-right', '0.6em', 'taskstatus');
		sc_change_css('padding-left', '0.6em', 'taskstatus');
		sc_change_css('border-radius', '14px', 'taskstatus');
		sc_change_css('font-weight', 'bold', 'taskstatus');
		sc_change_css('width', 'fit-content', 'taskstatus');
		sc_change_css('display', 'block', 'taskstatus');
		sc_change_css('padding-top', '0.2em', 'taskstatus');
		sc_change_css('padding-bottom', '0.2em', 'taskstatus');
		sc_change_css('font-size', '60%', 'taskstatus');
		sc_change_css('margin', '10%', 'taskstatus');
		break;
		
	case 'NOT-STARTED':
		sc_change_css('color', '#991b1b', 'taskstatus');
		sc_change_css('background-color', '#fee2e2', 'taskstatus');
		sc_change_css('padding-right', '0.6em', 'taskstatus');
		sc_change_css('padding-left', '0.6em', 'taskstatus');
		sc_change_css('border-radius', '14px', 'taskstatus');
		sc_change_css('font-weight', 'bold', 'taskstatus');
		sc_change_css('width', 'fit-content', 'taskstatus');
		sc_change_css('display', 'block', 'taskstatus');
		sc_change_css('padding-top', '0.2em', 'taskstatus');
		sc_change_css('padding-bottom', '0.2em', 'taskstatus');
		sc_change_css('font-size', '60%', 'taskstatus');
		sc_change_css('margin', '10%', 'taskstatus');
		break;
}

 


Macro Scope

Grid application
onClick
onRecord



sc_commit_trans("Connection")



This macro is used to confirm a transaction set in the database.

In form applications, there are events that perform transactions with the database (Ex: onAfterInsert, onAfterUpdate, onAfterDelete, onBeforeInsert, onBeforeUpdate, onBeforeDelete, etc...).
The transaction control of these events is done by Scriptcase itself if the connection provided is the same as the application.
However, if the user has to perform any type of redirection in these events, it is necessary to use the macro sc_commit_trans before the redirect to secure the transactions previously performed.

Ex: onAfterUpdate - Using redirection after update a record:

sc_commit_trans();

sc_redir('grid_main');


The "connection" parameter is optional, being necessary only if the command is executed in a different database specified to the application.


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onFooter
onHeader
onScriptInit
onClick
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onFooter
onHeader
onScriptInit
onRecord



sc_concat()

This macro returns a string resulting from a definition of two or more values Can be used in the lookup of fields or events together with the macros sc_lookup() and sc_select()

Makes concat formatting according to your database.

 

Ex. 1: Use(Editing Lookup):

SELECT field1, sc_concat(field2,' - ',field3) FROM table

 

Ex. 2: Using the macro with sc_lookup:

sc_lookup(Dataset,"SELECT field1,sc_concat(field2, ' - ' ,field3) FROM table");

Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateSuccess
onFooter
onHeader
onScriptInit
onClick
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateSuccess
onBlur
onChange
onClick
onFocus
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onExecute
onLoad
onFooter
onHeader
onScriptInit
onRecord



sc_confirm("Message")

This macro is used to confirm that the action must be really executed, preventing mistakes.

Valid only in the PHP programming code that runs when called through a toolbar button.

Parameter

This macro has only one parameter, which is the confirmation message that will be displayed.


Example:
sc_confirm("Do you really wish to execute this action??");

 

Related Links
See a practical example of how to use the sc_confirm macro


Macro Scope

Form application Control Form
onClick onClick



sc_connection_edit("Connetion_Name", $arr_conn)

La conexión editada solo estará disponible en la próxima aplicación.

1º Parameter: Connection name to be edited.

2º Parameter: Array of items containing the connection information to be edited. Check out the indices of the array:

Indice
Description Example
['server'] Database server (host) $arr_conn['server'] = "127.0.0.1"
['user'] Database username $arr_conn['user'] = "root"
['password'] Database password $arr_conn['password'] = "secretpass123"
['database'] Database name used in the connection $arr_conn['database'] = "sc_samples"
['persistent'] Defines if the connection is persistent or not $arr_conn['persistent'] = "Y" / "N"
['encoding'] Configure the connection encoding $arr_conn['encoding'] = "utf8"

Note:Is not required to use all the indices in the array, we can pass only the required ones.

Example:

$arr_conn = array();

$arr_conn['user'] = "admin2";
$arr_conn['password'] = "admin2pass";
$arr_conn['database'] = "sc_samples2";

sc_connection_edit("sc_connection", $arr_conn);

 

Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onCalendarApplicationInit
onCalendarScriptInit
onScriptInit
onLoad
onValidateSuccess
onApplicationInit
onFooter
onHeader
onScriptInit
onScriptInit onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onExecute
onLoad
onApplicationInit
onFooter
onHeader
onScriptInit
onRecord



sc_connection_new("Connection_Name", $arr_conn)

When used, the macro creates a new connection with the information inserted in its parameters. This connection is available throughout the current session Scriptcase and ceases to exist when the session is closed.

The new connection will only be available in the next application.

1º Parameter: Connection name.

Note: If there is a connection created within the Scriptcase with the same name, this macro has no effect. Connections created within the Scriptcase prevail. If you want to edit an existing connection, see the documentation for the macro sc_connection_edit.

2º Parameter: Array of items containing the connection information. Check out the indices of the array:

 

Indice
Description Example
['drive'] Driver of the database used for the connection (see table below) $arr_conn['drive'] = "oci8"
['server'] Database server (host) $arr_conn['server'] = "127.0.0.1"
['user'] Database username $arr_conn['user'] = "root"
['password'] Database password $arr_conn['password'] = "secretpass123"
['database'] Database name used in the connection $arr_conn['database'] = "sc_samples"
['persistent'] Defines if the connection is persistent or not $arr_conn['persistent'] = "Y" / "N"
['encoding'] Configure the connection encoding $arr_conn['encoding'] = "utf8"

Note: It is required that all items are filled, with the exception of items ['persistent'] and ['encoding'].

See below the driver's list:

 

Driver
Description
access MS Access
ado_access MS Access ADO
odbc ODBC Generic
db2 DB2
db2_odbc DB2 ODBC Native
odbc_db2 DB2 ODBC Generic
odbc_db2v6 DB2 ODBC Genérico 6 or less
pdo_db2_odbc DB2 PDO ODBC
pdo_ibm DB2 PDO
firebird Firebird
pdo_firebird Firebird PDO
borland_ibase Interbase 6.5 or more
ibase Interbase
pdo_informix Informix PDO
informix Informix
informix72 Informix 7.2 or less
ado_mssql MSSQL Server ADO
pdo_sqlsrv MSSQL Server NATIVE SRV PDO
mssqlnative MSSQL Server NATIVE SRV
odbc_mssql MSSQL Server ODBC
mssql MSSQL Server
pdo_dblib DBLIB
pdo_mysql MySQL PDO
mysqlt Mysql (Transactional)
mysql MySQL (Non-Transactional)
pdo_oracle Oracle PDO
oci805 Oracle 8.0.5 or more
odbc_oracle Oracle ODBC
oci8 Oracle 8
oci8po Oracle 8 Portable
oracle Oracle 7 or less
postgres7 PostgreSQL 7 ou Acima
pdo_pgsql PostgreSQL PDO
postgres64 PostgreSQL 6.4 or more
postgres PostgreSQL 6.3 or more
pdosqlite SQLite PDO
sqlite SQLite
sybase Sybase
pdo_sybase_dblib Sybase PDO DBLIB
pdo_sybase_odbc Sybase PDO ODBC

 

Example:

$arr_conn = array();

$arr_conn['drive'] = "mysqlt";
$arr_conn['server'] = "127.0.0.1";
$arr_conn['user'] = "root";
$arr_conn['password'] = "pass123";
$arr_conn['database'] = "sc_samples";
$arr_conn['persistent'] = "Y";
$arr_conn['encoding'] = "utf8";

sc_connection_new("new_conn_mysql", $arr_conn);

 
 

Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onCalendarApplicationInit
onCalendarScriptInit
onScriptInit
onLoad
onValidateSuccess
onApplicationInit
onFooter
onHeader
onScriptInit
onScriptInit onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onExecute
onLoad
onApplicationInit
onFooter
onHeader
onScriptInit
onRecord



sc_date(Date, "Format", "Operator", D, M, Y)

This macro has the aim to calculate the increment or decrement of dates. For its use are necessary some parameters as follows:

Parameter
Description
Date Date field that contains the date to be modified.
Format Formatting thats the date field is.
Operator "+" for increment and "-" for decrement.
D Number of days to increment or decrement.
M Number of months to increment or decrement.
Y Number of Years to increment or decrement.



Ex. 1:
{birthdate} = sc_date({birthdate}, "dd/mm/yyyy", "+", 30, 0, 0);

 

Ex. 2:
$new_date = sc_date({birthdate}, "yyyy-mm-dd", "-", 15, 3, 2);

 

Ex. 3:
{inclusion_dt} = sc_date(date('Ymd'), "yyyymmdd", "-", 0, 1, 1);

 

OBS: To be certified of the date format, before use the function, try it in any event:
echo "form_date =". {name of the field date};


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onFooter
onHeader
onScriptInit
onClick
onApplicationInit
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onFooter
onHeader
onScriptInit
onRecord



sc_date_conv({Field_Date}, "Input_Format", "Output_Format")

This macro converts the date field passed as a parameter with an input format to another field with an output format.

Check below the list of parameters for this macro and the accepted values.

Parameter Values Description


field_name

Example of how the parameter should be informed: {field_name}


This parameter must receive the name of the data field that will have the manipulated value




input_format

The string must have the same format used in the database.

Example of how to enter the date string in the macro: "yyyy-mm-dd"

Accepted values:

  • Date string - For example "yyyy-dd-mm"
  • db_Format - Retrieves the date format from the database.

Receives the string with the current date format, saved in the database.

If the format informed is different from the one used in the database, the macro will not work as expected.






output_format

The String must have the format in which the date will be displayed.

Example of how to enter the date string in the macro: "yyyy/dd/mm/"

Accepted options

  • Date string - For example "yyyy-dd-mm"
  • sc_format_region - Value formatted according to the regional configuration
  • db_Format - Convert the date to the database's native value

Receive the string with the desired date display format.

If you want to use the format according to the regional configuration, the value sc_format_region in this parameter must be informed


For more information on the data strings consult the PHP Manual

 

Ex. 1: Converts the date from"dd/mm/yyyy" format to the "yyyymmdd" format.

{field_date} = sc_date_conv({field_date}, "dd/mm/aaaa", "aaaammdd");

Ex. 2: Converts the date from the database native format to "dd/mm/yyyy" format.

{field_date} = sc_date_conv({field_date}, "db_format", "dd/mm/aaaa");

Ex. 3: Converts the date from the "dd/mm/yyyy" format to the Database native format(db_format).

{field_date} = sc_date_conv({field_date}, "dd/mm/aaaa", "db_format");

Ex. 4: Converting the date from the database's native format (db_format) to the regional setting format (sc_format_region)

{field_date} = sc_date_conv({field_date},"db_format","sc_format_region");

Ex. 5: Converting the date from the "yyyy-mm-dd" to the regional Setting format (sc_format_region)

{field_date} = sc_date_conv({field_date},"aaaa-mm-dd","sc_format_region");


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onFooter
onHeader
onScriptInit
onClick
onApplicationInit
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onFooter
onHeader
onScriptInit
onRecord



sc_date_dif({Date1}, "Format Date1", {Date2}, "Format Date2")

Calculates the difference between two dates (passed as parameters) in days.

 

Parameter
Description
Date1 Date1 value or variable.
Format Date1

Value or Variable containing the date format stored on Date1.

Date2 Date2 value or variable.
Format Date2 Value or Variable containing the date format stored on Date2.



Ex. 1:
{amount_days} = sc_date_dif({date1}, "aaaa-mm-dd", {date2}, "mm/dd/aaaa");

 

Ex. 2:
{amount_days} =
sc_date_dif("2000-05-01", "aaaa-mm-dd", "04/21/2004", "mm/dd/aaaa");
{amount_days} would be equal to -1451 (days)



Note: Formats can be different but must be in days, months and years.


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onFooter
onHeader
onScriptInit
onClick
onApplicationInit
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onFooter
onHeader
onScriptInit
onRecord



sc_date_dif_2({Date1}, "Format Date1", {Date2}, "Format Date2", Option)

Calculates the difference between two dates (passed as parameters) returning the number of days, months, and years.


The result is returned in an array structure, where index 0 have the number of days, index 1 has the number of months and the index 2 have the number of years.

 

Parameter
Description
Date1 Date1 value or variable.
Format Date1

Value or Variable containing the date format stored on Date1.

Date2 Date2 value or variable.
Format Date2 Value or Variable containing the date format stored on Date2.
Option 1 = Doesn't consider the initial day; 2 = Considers the initial day.



Ex. 1:
$diferences =
sc_date_dif_2 ({date1}, "yyyy-mm-dd", {date2}, "mm/dd/yyyy", 1);
{dif_days} = $diferences[0];
{dif_months} = $diferences[1];
{dif_years} = $diferences[2];

 

Ex. 2:
$diferences =
sc_date_dif_2 ("2000-05-01", "yyyy-mm-dd", "04/21/2004", "mm/dd/yyyy", 1);
$diferences[0] = 20 (days)
$diferences[1] = 11 (months)
$diferences[2] = 3 (years)

 


Ex. 3: Using the option 2
$diferences =
sc_date_dif_2 ("2000-05-01", "yyyy-mm-dd", "04/21/2004", "mm/dd/yyyy", 2);
$diferences[0] = 21 (days)
$diferences[1] = 11 (months)
$diferences[2] = 3 (years).


Note: Formats between the two dates can be different but it must have days, months and years. You also need to know the internal format being returned for the macro to work correctly.

 
 
 
 
 

Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onFooter
onHeader
onScriptInit
onClick
onApplicationInit
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onFooter
onHeader
onScriptInit
onRecord



sc_date_empty({Field_Date})

This macro checks if a date field is empty.


Ex. 1:
if (sc_date_empty({my_date}) )
{
sc_error_message("Invalid Date");
}


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onHeader onClick
onApplicationInit
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onFilterRefresh
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onLoadAll
onRefresh
onHeader
onRecord



sc_decode({My_Field})

This macro returns the encrypted field or variable to its original value.

Ex. 1: Using a local variable:
{my_field} = sc_decode($field_crypt);



Ex. 2: Using an user variable:
$my_var = sc_decode($field_crypt);


Note: Scriptcase's owner, Netmake, isn't responsible by the cryptography algorithm integrity (it is an open-source algorithm)


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onFooter
onHeader
onScriptInit
onClick
onApplicationInit
onHeader
onScriptInit
onNavigate
onRecord
onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onFooter
onHeader
onScriptInit
onRecord



sc_encode({My_Field})

Returns the field or variable with the content encrypted.


Ex. 1: Encrypting a local variable:
$field_crypt = sc_encode({my_field});



Ex. 2: Encrypting an user variable:
$field_crypt = sc_encode($my_var);

 

Note: Netmake isn't responsible by the encrypting algorithm integrity, (The algorithm provided is open source).


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onFooter
onHeader
onScriptInit
onClick
onApplicationInit
onHeader
onScriptInit
onNavigate
onRecord
onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onFooter
onHeader
onScriptInit
onRecord



sc_error_continue("Event")

This macro deactivates the Scriptcase standard database error treatment message for the event passed as parameter allowing it to be substituted by the programmer customized error treatment.

It can be used in along with variable: {sc_erro_delete}, {sc_erro_insert} and/or {sc_erro_update}

The events to be passed as parameter are: insert, delete or update.

 

Ex. 1: Using on the event onDelete for the message returned by mssql, trigger treatment, which cancels the record exclusion, displays a error message in the format [Microsoft] [ODBC SQL Server Driver] [SQL Server] You can't erase the record.

sc_error_continue("delete");
if (!empty({sc_error_delete}))
{
$tmp = strrpos({sc_error_delete}, "]");
if ($tmp !== false)
{
{sc_error_delete} = substr({sc_error_delete}, $tmp 1);
}
sc_error_message({sc_error_delete});
sc_error_exit;
}


Macro Scope

calendar application Form application Control Form
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit



sc_error_delete

This variable returns a string with a database error message, which occurs by trying to exclude a record.

It is used when there is a need to treat these messages.

Like for example, in case of database validations via triggers or procedures that they return messages.

 

Ex. 1: Content of the variable {sc_error_delete}, returning an error message generated by database trigger using

MsSQL.“[Microsoft] [ODBC SQL Server Driver] [SQL Server] You can't erase this register.”

Note: To access the database return error, sees the macro "sc_error_continue".


Macro Scope

calendar application Form application
onAfterDelete onAfterDelete



sc_error_exit(URL / My_Application, "Target");

The sc_error_exit macro interrupts code execution.

When used without a parameter, the macro uses a return, so when using it in a PHP method only the execution of the code in the method will be interrupted, returning to the originating event and executing the rest of the code. In this case, to interrupt the execution of the application event, the macro must also be used when returning the method.

This macro must be used after the macro sc_error_message();

Parameters

It has two parameters that are not mandatory and the use or not of the parameters interferes with the functioning of the macro.

Parameter Description Parameter passing
app_name/URL

This parameter is not mandatory.

When informed, whenever the macro is triggered, the user will be redirected to the informed application or page, which can be opened in the same tab or in a new one,according to the target parameter.

The application name or URL must be enclosed in double or single quotation marks.

Example with URL sc_error_exit('www.scriptcase.com.br');

Example with Application
sc_error_exit('app_Login');

target

This parameter is not mandatory.

It defines whether the application/URL will be opened in the same tab or in a new one.

Values ​​can be:

  • _blank - Which displays the application/URL in a new tab.
  • _self - Displays the application/URL in the same tab as the application.

If no value is entered, the _self will be used as the default.

This parameter must be entered in double or single quotes.

Example opening the same tab sc_error_exit('www.scriptcase.com.br');

Example opening the same tab with target
sc_error_exit('www.scriptcase.com.br', '_self');

Example opening new tab
sc_error_exit('app_Login', '_blank');

 

Examples

Ex. 1: Displays only the error message.

sc_error_message("Error message");
sc_error_exit();

Ex. 2: Displays error messages and the "OK" button to redirect to the specified URL.

sc_error_message("Error message");
sc_error_exit(http://www.meusite.com);

Ex. 3: Displays error messages and the "OK" button to redirect to the informed Application.

sc_error_message("Error message");
sc_error_exit("my_application", "_blank");

Macro Scope

calendar application Grid application Search application Form application Control Form
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onValidate
onValidateFailure
onValidateSuccess
onClick onFilterValidate ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onNavigate
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess



sc_error_insert

This variable returns a string with the database error, that occurs when adding a record. It is used when is needed to treat these messages. For example, in the case of database validations via triggers or procedures that returns a message.

Ex. 1: Variable {sc_erro_insert}, returning an error message generated by database trigger the using MS SQL

“[Microsoft] [ODBC SQL Server Driver] [SQL Server] You cannot add this record.”

Note: To access the return of the database error, see the macro "sc_error_continue".


Macro Scope

calendar application Form application
onAfterInsert onAfterInsert



sc_error_message("Text")

This macro generates an error message or error messages.

In "Form and Control" applications, the messages are presented together with other error messages found in the application, except when using the "sc_error_exit" macro.

In "Grid and Menu" applications the messages only will be presented through the "sc_error_exit" macro.


Ex. 1:
if ({discount} > 0.10 && [glo_usr] == 'operator')
{
sc_error_message("Discounting of " . {discount} . " above of the allowed one");
}

In this example, if the value in the discount field is over 0.10 and the user try to add or save this record, the operation is finished and the error message is presented. The command must finish with ");" (close parentheses and semicolon) used as a delimiter for the macro interpreter.


Macro Scope

Blank application calendar application Search application Form application Control Form
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onValidate
onValidateFailure
onValidateSuccess
onFilterValidate ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onLoad
onNavigate
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess



sc_error_update

This variable returns a string with a database error message that occurs when updating a record. It is used when there is a need to customize these messages. For example, in the case of database validations via triggers or procedures that return message.


Ex. 1: Variable {sc_error_update}, returning an error message generate by a database trigger using MS SQL.

“[Microsoft][ODBC SQL Server Driver][SQL Server] You can't update this record.”

Note: To have access to the return of database error see the macro "sc_error_continue".


Macro Scope

calendar application Form application
onAfterUpdate onAfterUpdate



sc_exec_sql("SQL Command", "Connection")

This macro allows to condition the circumstances thats the SQL commands are executed.

The "Connection" parameter is optional. Required only, if the command is executed in a database different from the application.

Ex. 1:
if (sc_after_delete) {
sc_exec_sql("delete from mytable where key = {key_ant}");
}


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onCalendarScriptInit
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onFooter
onHeader
onScriptInit
onClick
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onFooter
onHeader
onScriptInit
onRecord



sc_exit(Option)

This macro can be used in the ScriptCase events and created a button and may return values/processes after the execution.

Option
Description
sc_exit() Returns to the previous application without display anything.
sc_exit(ok) Displays a window with an OK button and returns to the previous application.
sc_exit(sel) Doesn’t display the window with an OK button and returns to the current application, repeat the application select.
sc_exit(ref) It doesn't display the window with an OK button refresh data and returns to the current application.
sc_exit(ok,ref) Same as the sc_exit(ref) function; however, display the OK button.
sc_exit(ok,sel) Same as the sc_exit(sel) function; however, display the OK button.


This option is only valid for Form and Control Applications.

Opton
Description
sc_exit() Doesn't complete transactions in database.
sc_exit(c) Commit pending transactions.
sc_exit(r) Rollback pending transactions.

Macro Scope

calendar application Form application Control Form
onScriptInit onClick
onScriptInit
onClick
onScriptInit



sc_field_color("Field", "Color")

This macro is used to change/restore a grid field text color dynamically.

Ex. 1: Change the grid text field “customer_id” color.
sc_field_color ("customerid", "#33FF66");


Ex. 2: Change the "value_order” field text color, if the value is greater that 1000. Otherwise, use the default color.
if ({value_order} > 1000)
{
sc_field_color ("value_order", "#33FF66");
}
else
{
sc_field_color ("value_order", "");
}



Ex. 3: Using a local variable.

sc_field_color ("customerid", {fld_color});



Ex. 4: Using a global variable.

sc_field_color ("customerid", [glo_color]);


Macro Scope

Grid application ReportPDF application
onScriptInit
onRecord
onScriptInit
onRecord



sc_field_disabled("Field_Name = True/False", "Parameter")

This macro is used to block a field to get any data that would be typed on it.

Fields that is going to be blocked should be followed by the option "true" (default) or "false".

The parameter is optional, "I" it's used only to block de addition of new records, "U" to block only the update, in case of the parameter has not been informed the Scriptcase will use both options.

 

Ex. 1: Blocks only one field for addition and update.
sc_field_disabled("Field_01");

Ex. 2: Unblocking a field for addition and update.
sc_field_disabled("Field_02=false");

Ex. 3: Blocks several fields, only for an update.
sc_field_disabled("Field_01; Field_02; Field_03", "U");

Ex. 4: Combination of the block and unblock of several fields, for addition and update.
sc_field_disabled("Field_01=true; Field_02=false; Field_03=true");


Macro Scope

calendar application Form application Control Form ReportPDF application
onLoad onLoad
onNavigate
onLoadAll onHeader



sc_field_disabled_record("Field_Name = True/False", "Parametre")

This macro has the objective to block the typing on determining fields in the lines of the Multiple Record form, Editable Grid, and Editable Grid View.

Fields that are supposed to be blocked should be applied the options, "true" ( To block) or "false" ( to unblock). If not informed, the default value is "true".

The optional parameter is using the “I” to block while inserting a new record and “U” to block while updating a record. If not informed, Scriptcase will block on both occasions by default.

Ex. 1: Blocking the field while including and updating.
sc_field_disabled_record(“Field_01");

Ex. 2: Unblocking the field while including and updating.
sc_field_disabled_record(“Field_02=false");

Ex. 3: Blocking the various fields only when updating.
sc_field_disabled_record(“Field_01; Field_02; Field_03", "U");

Ex. 4: Combination of blocking and unblocking various fields while including and updating.
sc_field_disabled_record("Field_01=true; Field_02=false; Field_03=true");

The macro can also work within a condition, blocking a specific field on the record line.

Example 1:
if ({Filed_01} == 1)
{
sc_field_disabled_record("Field_03");
}

Example 2:
switch(trim([arr_apps][ {app_name} ]))
{
case 'form':
break;
case 'calendar':
sc_field_disabled_record("priv_export; priv_print");
break;
case 'cons':
sc_field_disabled_record("priv_insert; priv_delete; priv_update");
break;
default:
sc_field_disabled_record("priv_insert; priv_delete; priv_update; priv_export; priv_print");
break;
}


Macro Scope

Form application
onLoadRecord



sc_field_display({My_Field}, on/off)

This macro will display a specific field dynamically.
By default, all the fields are displayed ("on" condition").


Ex. 1:
if ({tp_customeri} == "personal")
{
sc_field_display({company_name}, off);
}
else
{
sc_field_display({personal_name}, off);
}

 

Ex. 2: Using a local variable as second parameter

 

$var = "off";

sc_field_display({company_name}, $var);


Macro Scope

calendar application chart application Grid application Form application Control Form
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onHeader
onScriptInit
onScriptInit ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onBeforeInsertAll
onBeforeUpdateAll
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure



sc_field_init_off(Field1, Field2,...)

This macro is intended to inhibit the query fields on the initial load.

Fields inhibited by this macro can be enabled by using the "Columns" button.



Ex 01:

sc_field_init_off ({orderID}, {TotalValue});


Macro Scope

Grid application
onApplicationInit



sc_field_no_validate('field_name')

The macro can only be used in the onLoad event of Form, Control and Calendar applications.
It allows ignoring the validations of the fields informed in the parameter, allowing the developer to dynamically "remove" the validations according to his business rule.

It is worth mentioning that only the validations defined in the field configuration screen will be ignored by the macro. Validations created by the developer in events, methods or libraries will not be considered.

Check some validations that will be ignored with the use of the macro.

  • Field data types: Date, credit card, email, and zip code.
  • Formatting text field values: Maximum, minimum value and characters allowed.
  • Formatting numeric field values: Maximum and minimum value.
  • Fields marked as mandatory.

See below for details about the macro parameter.

Macro Parameter

Parameter Syntax Description
field_name

The parameter expects to receive the name of the fields in quotes (single or double) or in curly brackets {field_name}. It is also possible to enter two or more fields, in which case the names must be separated by a comma.


Syntax with a field

// field name in quotes
sc_field_no_validate('field_name');
// field name in curly brackets
sc_field_no_validate({field_name});

Syntax with two or more fields

// Two and more fields
sc_field_no_validate({field_name1}, {field_name2});

This parameter is mandatory and must receive the name of the fields that will have the validation disregarded.

It is possible to inform more than one field, in this case, the names must be separated by a comma.

 

Lista de Exemplos

 

Removing validation from a field hidden by the macro sc_field_display.

sc_field_display({field1}, 'off');
sc_field_no_validate({field1});

 

Example using multiple fields in curly brackets.

sc_field_no_validate({field1}, {field2}, {field3});

 

Example using multiple fields with quotes.

sc_field_no_validate('field1', 'field2', 'field3');

Macro Scope

calendar application Form application Control Form
onLoad onLoad
onLoadRecord
onLoadAll



sc_field_readonly({Field}, on/off)

This macro dynamically sets a form field attribute to 'ReadOnly'. Use this macro only to do it at 'runtime'. Otherwise set this parameter on / off on the form interface. section "Read-Only".

The on/off parameter its optional, used by an ajax event to define if a field is going to be read-only (On) or read-only (Off).

 

Ex 1: To set a field as read only even when the form is in "Addition mode":
if (sc_btn_new)
{
sc_field_readonly({my_field});
}

Ex. 2: To set a field as read only dynamically use:
sc_field_readonly({my_field});


Macro Scope

calendar application Form application Control Form
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onBeforeInsertAll
onBeforeUpdateAll
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure



sc_field_style({My_Field}, "Background-Color", "Size", "Color", "Family", "Weight")

This macro allows to dynamically modify the grid field style.

Parameter Description
Field Name
Background-Color (optional) Field cell background Color
Size (optional) Field font size
Color (optional) Font Color
Family (optional) Font family
Weight (optional) Font weight

 

Ex. 1:
sc_field_style({my_field}, '#33FF99', '15px', '#000000', 'Arial, sans-serif', 'bold');


Macro Scope

Grid application
onRecord



sc_foot_hide()

 

This macro is intended to hide the application footer.

With no mandatory parameter, the macro is available in the following applications:

  • Form
  • Control
  • Graphic
  • Grid

In the Grid, in addition to its standard use (without parameters), it is possible to individually define the module where the display of the footer will be inhibited.

Below is the list of unique grid parameters

 

  • grid - Hide only the footer of the grid module
  • res or sum - Hide only the summary module footer
  • det - Hides the detail module footer

 

Remembering that the parameters are not mandatory, in the case of the query, if no parameter is informed, the footer display will be inhibited in all modules.

 

Examples


Eg. no parameter - Default use of the macro, without passing a parameter, inhibits the display of the footer in the Form, Control, Graph and in all modules of the query.

sc_foot_hide();

 

Below are examples of using the macro with parameter, exclusively for use in the grid


Eg. using the 'grid' parameter - Inhibits the visualization of the footer only in the application module.

sc_foot_hide('grid');

 

Eg. using the 'sum' parameter - Inhibits the display of the footer only in the module in the application summary.

sc_foot_hide('res'); or sc_foot_hide('sum');

 

Eg. using the 'det' parameter - Inhibits the visualization of the footer only in the module in the application summary.

sc_foot_hide('det');

 

Eg. using more than one parameter - Inhibits the visualization of the footer in the grid and application detail modules.

In this case the parameters must be separated by a comma.

sc_foot_hide('grid,det');


Macro Scope

chart application Grid application Form application Control Form
onScriptInit onScriptInit onScriptInit onScriptInit



sc_format_num({My_Field}, "Group_Symb", "Dec_Symb", "Amount_Dec", "Fill_Zeros", "Side_Neg", "Currency_Symb", "Side_Currency_Symb")

This macro is used to format numerical values.

 

Parameter
Description
My_Field Variable or field to format (The return is in the next variable).
Group_Symb Integer values grouping symbol.
Dec_Symb Decimals separator symbol.
Amount_Dec Number of decimals to be displayed.
Fill_Zeros Complete decimals with zeros (fill in) (S = yes and N = no).
Side_Neg Negative sign position. (1 = left and 2 = right)
Currency_Symb Monetary symbol to be displayed.
Side_Currency_Symb Currency symbol position. (1 = left and 2 = right).



Ex. 1: Formatting an integer.
sc_format_num({my_value}, '.', '', '0', 'N', '1', '');
Input value = 001234567890
Output value = 1.234.567.890

Ex. 2: Formatting a negative value and truncating decimals.
sc_format_num({my_value}, '.', '', '0', 'N', '1', '');
Input value = 0012345678.90-
Output value = -12.345.678

Ex. 3: Formatting a value with 4 decimals and filling with zeros.
sc_format_num({my_value}, '.', ',', '4', 'S', '1', '');
Input value = 0012345678.9
Output value = 12.345.678,9000

Ex. 4: Formatting a value with 2 decimals, filling with zeros and using monetary symbol.
sc_format_num({my_value}, '.', ',', '2', 'S', '1', 'US$');
Input value = 0012345678.9
Output value = US$ 12.345.678,90

Ex. 5: Formatting a value with 2 decimals, filling with zeros.
sc_format_num({my_value}, '.', ',', '2', 'S', '1', '');
Input value = .9
Output value = 0,90

 

Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onFooter
onHeader
onScriptInit
onClick
onApplicationInit
onFooter
onHeader
onScriptInit
onNavigate
onRecord
onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onExecute
onLoad
onApplicationInit
onFooter
onHeader
onScriptInit



sc_format_num_region({My_Field}, "Qtde_Dec", "Insert_Zeros", "Monetary_Sym")

This macro has the objective to format numbers, using the regional settings

Parameter
Description
My_Field Variable or field that has a value to be formatted (if the value is 0 the result will be the same as the variable).
Qtde_Dec Amount of decimals that'll be displayed.
Insert_Zeros Complete with the non existing decimals (Y = yes and N = no).
Monetary_Sym Display monetary symbol (Y = yes and N = no).

 

 

Ex. 1: Formatting a value with 2 decimal spaces, inserting the zeros and the monetary value.
sc_format_num_region({my_value}, "2", "Y", "Y");
Input value = 9
Output value = R$0,90


Macro Scope

Blank application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu
onExecute onClick
onApplicationInit
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad



sc_form_show'on' or 'off'

This macro dynamically display or hide a form.
By default, the form is displayed ("on" condition).

Ex. 1: Does not display the form.
sc_form_show = 'off';


Macro Scope

calendar application Form application Control Form
onScriptInit
onLoad
onValidate
onScriptInit
onLoad
onValidate
onScriptInit
onLoadAll



sc_getfield("myField")

This macro is used to assign objects (that represent the field's form) to a javascript variable, allowing the user to access the object properties. This macro will run on control and forms at the javascript events and methods.

 

EX:

Showing the value of the "client" field of a form cli_js = sc_getfield('cliente'); alert (cli_js.value);


Macro Scope




sc_get_groupby_rule()

This macro is used to retrieve the name of the Group By rule that is being used at this moment. The return value is a String containing the name of the rule.

 

Ex:

if (sc_get_groupby_rule() == "rule1")

{

[title] = "Sales X Region";

}

 


Macro Scope

Grid application
onScriptInit
onNavigate
onRecord



sc_get_language

This macro returns the abbreviation of the language being used.

 

Ex. 1:

$my_language = sc_get_language();


Language Value
Arabic ar
Bahasa Melayu ms
Belarusian be
Bengali bn
Bosnian bs
Bulgarian bg
Catalan ca
Chinese Simplified zh_cn
Chinese Traditional zh_hk
Croatian hr
Czech cz
Danish da
Dutch nl
English en_us
Estonian et
Finnish fi
French fr
Galician gl
German de
Greek el
Gujarati gu
Hebrew he
Hindi hi
Hungarian hu_hu
Indonesian id
Italian it
Japanese ja
Kannada kn
Korean ko
Latvian lv
Lithuanian lt
Macedonian mk
Marathi mr
Norwegian no
Polish pl
Portuguese Brazil pt_br
Portuguese Portugal pt_pt
Punjabi pa
Romanian ro
Russian ru
Serbian Cyrillic sr
Shuar jiv
Sinhalese si
Slovak sk
Slovenian sl
Spanish es
Swedish sv
Telugu te
Thai thai
Turkish tr
Ukrainian uk
Urdu ur

Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onFooter
onHeader
onScriptInit
onFooter
onScriptInit
onNavigate
onRecord
onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onFooter
onHeader
onRecord



sc_get_regional

This macro returns the abbreviation of the regional settings being used.

 

Ex. 1:

$my_regional = sc_get_regional();


Language Value
Afrikaans (South Africa) af_za
Albanian (Albania) sq_al
Amharic (Ethiopia) am_et
Arabic (Algeria) ar_dz
Arabic (Bahrain) ar_bh
Arabic (Egypt) ar_eg
Arabic (Iraq) ar_iq
Arabic (Jordan) ar_jo
Arabic (Kuwait) ar_kw
Arabic (Lebanon) ar_lb
Arabic (Libya) ar_ly
Arabic (Morocco) ar_ma
Arabic (Oman) ar_om
Arabic (Qatar) ar_qa
Arabic (Saudi Arabia) ar_sa
Arabic (Syria) ar_sy
Arabic (Tunisia) ar_tn
Arabic (United Arab Emirates) ar_ae
Arabic (Yemen) ar_ye
Armenian (Armenia) hy_am
Azerbaijan (Azerbaijan) az_az
Bahasa Melayu (Malaysia) ms_my
Basque eu
Belarusian (Belarus) be_by
Bengali (Bangladesh) bn_bd
Bengali (India) bn_in
Bosnian (Bosnia-Herzegovina) bs_ba
Breton (France) br_fr
Bulgarian (Bulgaria) bg_bg
Catalan (Spain) ca_es
Chinese (Republic of China) zh_cn
Chinese (Simplified, Singapore) zh_sg
Chinese (Traditional, Hong Kong) zh_hk
Chinese (Traditional, Macau) zh_mo
Chinese (Traditional, Taiwan) zh_tw
Croatian (Bosnia and Herzegovina) hr_ba
Croatian (Croatia) hr_hr
Czech (Czech Republic) cs_cz
Danish (Denmark) da_dk
Dutch (Belgium) nl_be
Dutch (Netherlands) nl_nl
English (Australia) en_au
English (Belize) en_bz
English (Botswana) en_bw
English (Cameroon) en_cm
English (Canada) en_ca
English (Caribbean) en_cb
English (India) en_in
English (Ireland) en_ie
English (Jamaica) en_jm
English (Malaysia) en_my
English (Namibia) en_na
English (New Zealand) en_nz
English (Nigeria) en_ng
English (Philippines) en_ph
English (Singapore) en_sg
English (South Africa) en_za
English (Trinidad and Tobago) en_tt
English (Uganda) en_ug
English (United Kingdom) en_gb
English (United States) en_us
English (Zambia) en_zm
English (Zimbabwe) en_zw
Estonian (Estonia) et_ee
Faroese (Faroe Islands) fo_fo
Finnish (Finland) fi_fi
French (Belgium) fr_be
French (Cameroon) fr_cm
French (Canada) fr_ca
French (France) fr_fr
French (Ivory Coast) fr_ci
French (Luxembourg) fr_lu
French (Monaco) fr_mc
French (Switzerland) fr_ch
Frisian, Western (Netherlands) fy_nl
Galician (Spain) gl_es
Georgian (Georgia) ka_ge
German (Austria) de_at
German (Germany) de_de
German (Lichtenstein) de_li
German (Luxembourg) de_lu
German (Switzerland) de_ch
Greek (Greece) el_gr
Gujarati (India) gu_in
Hausa (Ghana) ha_gh
Hebrew (Israel) he_il
Hindi (India) hi_in
Hungarian (Hungary) hu_hu
Icelandic (Iceland) is_is
Indonesian (Indonesia) id_id
Irish (Ireland) ga_ie
Italian (Italy) it_it
Italian (Switzerland) it_ch
Japanese (Japan) ja_jp
Kalaallisut (Kalaallit Nunaat) kl_gl
Kannada (India) kn_in
Kazakh (Kazakhstan) kk_kz
Khmer (Cambodia) km_kh
Kirghiz (Kyrgyzstan) ky_kg
Korean (Korea) ko_kr
Lao (Laos) lo_la
Latvian (Latvia) lv_lv
Lithuanian (Lithuania) lt_lt
Luxembourgish (Luxembourg) lb_lu
Macedonian (Republic of Macedonia) mk_mk
Malayalam (India) ml_in
Marathi (India) mr_in
Mongolian (Mongolia) mn_mn
Nepali (Nepal) ne_np
Northern Sotho (South Africa) nso_z
Norwegian (Norway) no_no
Norwegian Bokmal (Norway) nb_no
Norwegian Nynorsk (Norway) nn_no
Occitan (France) oc_fr
Oriya (India) or_in
Persian (Iran) fa_ir
Polish (Poland) pl_pl
Portuguese (Angola) pt_ao
Portuguese (Brazil) pt_br
Portuguese (Portugal) pt_pt
Punjabi (India) pa_in
Romanian (Moldova) ro_md
Romanian (Romania) ro_ro
Russian (Belarus) ru_by
Russian (Kazakhstan) ru_kz
Russian (Russia) ru_ru
Serbian Cyrillic (Serbia and Montenegro) sr_yu
Serbian Latin (Serbia and Montenegro) sh_yu
Slovak (Slovak Republic) sk_sk
Slovenian (Slovenia) sl_si
Sotho (South Africa) st_za
Spanish (Argentina) es_ar
Spanish (Bolivia) es_bo
Spanish (Chile) es_cl
Spanish (Colombia) es_co
Spanish (Costa Rica) es_cr
Spanish (Dominican Republic) es_do
Spanish (Ecuador) es_ec
Spanish (El Salvador) es_sv
Spanish (Guatemala) es_gt
Spanish (Honduras) es_hn
Spanish (Mexico) es_mx
Spanish (Nicaragua) es_ni
Spanish (Panama) es_pa
Spanish (Paraguay) es_py
Spanish (Peru) es_pe
Spanish (Puerto Rico) es_pr
Spanish (Spain) es_es
Spanish (United States) es_us
Spanish (Uruguay) es_uy
Spanish (Venezuela) es_ve
Sri Lanka (Sinhalese) si_si
Swahili (Tanzania) sw_tz
Swedish (Finland) sv_fi
Swedish (Sweden) sv_se
Tajik (Tajikistan) tg_tj
Tamil (India) ta_in
Telugu (India) te_in
Thai (Thailand) th_th
Tswana (South Africa) tn_za
Turkish (Turkey) tr_tr
Ukrainian (Ukraine) uk_ua
Urdu (Pakistan) ur_pk
Uzbek (Uzbekistan) uz_uz
Vietnamese (Vietnam) vi_vn
Welsh (United Kingdom) cy_gb
Xhosa (South Africa) xh_za
Zulu (South Africa) zu_za

Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onFooter
onHeader
onScriptInit
onFooter
onScriptInit
onNavigate
onRecord
onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onHeader
onRecord



sc_get_theme

This macro returns the application theme used.

 

Ex. 1:

$my_theme = sc_get_theme();


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onFooter
onHeader
onScriptInit
onFooter
onScriptInit
onNavigate
onRecord
onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onFooter
onHeader
onScriptInit
onRecord



sc_get_wizard_step

This macro works in the form application only when it is configured to work as a step form.
With this macro it is possible to identify the current stage that the end user is in and thus perform any necessary validation.

For the macro to work, the form must be configured with at least two steps or more. It has no parameters.

 


Example: Validation of unfilled fields.

if (sc_get_wizard_step() == 1) {

    if ( empty({contactname}) ) {  

        sc_error_message("Fill the field Contactname");  

    }
}

Macro Scope

Form application
onValidate



sc_groupby_label("My_Field")

This Macro dynamically modifies the field label displayed in the group by lines.

Ex. 1:
sc_groupby_label('state') = "state grouping";


Ex. 2:
sc_groupby_label('balance') = "balance total";


Macro Scope

Grid application
onGroupBy



sc_head_hide()

 

This macro is intended to hide the application header.

With no mandatory parameter, the macro is available in the following applications:

  • Form
  • Control
  • Graphic
  • Grid

In the Grid application, in addition to its standard use (without parameters), it is possible to individually define the module where the display of the header will be inhibited.

Below is the list of unique grid parameters

 

  • grid - Hide only the header of the grid module
  • res or sum - Hide only the summary module header
  • det - Hides the detail module header

 

Remembering that the parameters are not mandatory, in the case of the grid application, if no parameter is informed, the header display will be inhibited in all modules.

 

Examples


Eg. no parameter - Default use of the macro, without passing a parameter, inhibits the display of the header in the Form, Control, Chart and in all modules of the Grid.

sc_foot_hide();

 

Below are examples of using the macro with parameter, exclusively for use in the grid


Eg. using the 'grid' parameter - Inhibits the header view only in the grid application grid module.

sc_foot_hide('grid');

 

Eg. using the 'sum' parameter - Inhibits the header view only in the grid application summary module.

sc_foot_hide('res'); or sc_foot_hide('sum');

 

Eg. using the 'det' parameter - Inhibits the header view only in the grid application detail module.

sc_foot_hide('det');

 

Eg. using more than one parameter - Inhibits the visualization of the header in the grid application and detail module.

In this case the parameters must be separated by a comma.

sc_foot_hide('grid,det');

Macro Scope

chart application Grid application Form application Control Form
onScriptInit onScriptInit onScriptInit onScriptInit



sc_hide_groupby_rule('group1', 'grop2', 'group3')

This macro is used to disable Group By rules in execution time.

The Group By rules ID should be informed as parameters in the macro.

This macro will only work if there are at least two group by, so using the macro, one group by will be disabled and other remains showing.

Ex:

if( [usr_login_group] == 'seller' ){

sc_hide_groupby_rule('rule_1', 'rule_2');

}

 

Macro Scope

Grid application
onApplicationInit



sc_image(Image01.jpg)

This macro is used to copy images in some events or Javascript commands to load images to an application.

All images used in the applications are automatically copied to each application.

Ex. 1:
sc_image (img1.gif, img2.jpg);


Note: The images must exist in the development environment images directory (../devel/conf/sys/img/img/).


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute onApplicationInit
onScriptInit
onLoad
onValidate
onApplicationInit
onScriptInit
onFooter
onScriptInit
onFilterInit onApplicationInit
onClick
onScriptInit
onLoad
onLoadRecord
onValidate
onApplicationInit
onScriptInit
onLoadAll
onValidateFailure
onValidateSuccess
onApplicationInit
onLoad
onApplicationInit
onLoad
onLoad onApplicationInit
onScriptInit



sc_include("File", "Source")

The Scriptcase allows the user to catalog his PHP scripts to use in various applications.

To catalog the scripts go to the ScriptCase main menu at "Tools > Library" and use the "upload" option existing in the interface.

When a script is cataloged, the user has the option of the context choice where it will be stored, global level (Scriptcase), group level or user level.
- Public: All the projects will have access.
- Project: Only the project users (the ones that will be logged at that time) will have access.
- User: Only the user (the ones that will be logged at that time) will have access.


The sc_include macro, the user must inform the script name that will be included and the source.
- Script Name: Script name to be included.

The Source context that the script was saved, that could be:
- Sys or Blank: Scriptcase global level.
- Prj: Group level.
- Usr: User level.


Ex. 1: Including a catalogued script to global level.
sc_include(my_script.php);



Ex. 2:
Including a catalogued script to the group level.
sc_include(my_script.php, grp);



Ex. 3: Including a catalogued script to the user level.
sc_include(my_script.php, usr);


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onHeader
onScriptInit
onScriptInit
onNavigate
onRecord
onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onExecute
onLoad
onApplicationInit
onHeader
onScriptInit
onRecord



sc_include_lib("Lib1", "Lib2", ...)

This macro is used to dynamically select the application libraries.

 

PHP Libraries
JavaScript Libraries
tcpdf Jquery
fpdf_html jquery_thickbox
excel jquery_blockui
rtf tiny_mce
phpspreadsheet jquery_touch_punch
-
fusioncharts
-
jsmind
-
jkanban
-
orgchart

Ex. 1:

sc_include_lib ("tcpdf");

$pdf=new TCPDF();
$pdf->AddPage();
$pdf->SetFont('Helvetica','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();

 

Ex. 2:

?>
sc_include_lib ("jsmind");
< ?php
 

Macro Scope

Blank application Grid application
onExecute onScriptInit



sc_include_library("Target", "Library Name", "File", "include_once", "Require")

This macro includes a PHP file from a library in the application. You must have a library created in Scriptcase to make use of this macro. To create a library, go to "Tools -> Libraries".

Parameter
Description
Target Tells you what the scope of the library. It can be "sys" for libraries of Public scope or "prj" for libraries of the Project scope.
Library Name Name given to the library at the time of creation.
File The absolute path within the library.
include_once (optional) Make sure that the file will only be included once. If not informed, this value is set as "true".
Require (optional) If the file or library does not exist, the application to be executed and returns an error. If not informed, the value is set as "true".

 

 

Ex: Including a file from a library:
sc_include_library("prj", "phpqrcode", "qrlib.php", true, true);

 


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onFooter
onHeader
onScriptInit
onScriptInit
onRecord
onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onExecute
onLoad



sc_label("field_name")

This macro allows dynamically changing the label of fields in grid, form, and control applications.

Parameters

The macro has only one mandatory parameter, which receives the name of the field whose label will be changed.
This parameter must be provided in quotes (double or single) or by a variable, as in the syntax examples below. 

//Providing as a string
sc_label("customerid") = "New label for the field";

//Providing with a variable
$var_
field = "field_name";
sc_
label($var_field) = "New label for the field";

 

Examples

Ex. 1: User Registration
In this scenario, a single form is used to register employees and customers.

if ({user_type} == 'customer') {
    sc_label('field_id') = 'Customer ID';
} else {
    sc_label('field_id') = 'Employee ID';
}

 

Ex. 2: Event Registration
In an event registration form, the field labels can be changed to reflect the type of event (e.g., Conference, Workshop, Seminar). 

if ({event_type} == 'conference') {
    sc_label('location') = 'Conference Location';
} else if ({event_type} == 'workshop') {
    sc_label('location') = 'Workshop Location';
} else if ({event_type} == 'seminar') {
    sc_label('location') = 'Seminar Location';
}

 


Macro Scope

calendar application chart application Grid application Form application Control Form ReportPDF application
onScriptInit
onLoad
onRefresh
onScriptInit onClick
onScriptInit
onNavigate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onBlur
onChange
onClick
onFocus
onScriptInit
onLoadAll
onScriptInit



sc_language

This macro returns the language and regional settings.

 

Ex. 1:

echo "Language: ".{sc_language};


Language Value
Arabic ar
Bahasa Melayu ms
Belarusian be
Bengali bn
Bosnian bs
Bulgarian bg
Catalan ca
Chinese Simplified zh_cn
Chinese Traditional zh_hk
Croatian hr
Czech cz
Danish da
Dutch nl
English en_us
Estonian et
Finnish fi
French fr
Galician gl
German de
Greek el
Gujarati gu
Hebrew he
Hindi hi
Hungarian hu_hu
Indonesian id
Italian it
Japanese ja
Kannada kn
Korean ko
Latvian lv
Lithuanian lt
Macedonian mk
Marathi mr
Norwegian no
Polish pl
Portuguese Brazil pt_br
Portuguese Portugal pt_pt
Punjabi pa
Romanian ro
Russian ru
Serbian Cyrillic sr
Shuar jiv
Sinhalese si
Slovak sk
Slovenian sl
Spanish es
Swedish sv
Telugu te
Thai thai
Turkish tr
Ukrainian uk
Urdu ur

Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute onApplicationInit
onCalendarApplicationInit
onCalendarScriptInit
onScriptInit
onApplicationInit
onScriptInit
onScriptInit onApplicationInit
onFilterInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onValidate
onValidateSuccess
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onScriptInit



sc_ldap_login

$ldapConn = sc_ldap_login($server [, $domain, $user, $password, $dn, $group]);

This macro initiates the connection and bind it to the user credentials. This macro needs the following parameters:

Server =
Domain =
User =
Password =
DN =
Group =

There are three possible returns:

Macro return Situation
(string)'ldap_connect_error' Connection error with LDAP host/service.
(string)'ldap_bind_error' Authentication error after successful connection.
(resource) Successful connection and bind.

Macro Scope

calendar application Form application Control Form
onApplicationInit
onValidate
onApplicationInit
onValidate
onApplicationInit
onValidate



sc_ldap_logout()

This macro is used to release the connection after using the macro sc_ldap_login.

 

 

Ex1:

sc_ldap_logout();


Macro Scope

calendar application Form application Control Form
onApplicationInit
onValidate
onApplicationInit
onValidate
onApplicationInit
onValidate



sc_ldap_search( $filter = 'all', $attributes = array() )

This macro is used to perform searches in the LDAP.

 

Parameter Description
$filter 'all' or 'member':
'all' returns all information that the logged user can see.
'member' returns the information about that member
$attributes Array of LDAP filter options.

 

Ex:

$result = sc_ldap_search($filter, array('mail', 'displayname'));


Macro Scope

calendar application Form application Control Form
onApplicationInit
onValidate
onApplicationInit
onValidate
onApplicationInit
onValidate



sc_link(Column, Application, Parameters, "Hint", "Target", Height, Width)

Allows you to dynamically create a field connection between two applications.

Note: This macro is only available in Query.

Below is the list of macro parameters, which must be informed separated by commas.

Parameter Value Description
Column

Accepts only string with or without quote protection.

For example: 

sc_link(customerid, form_customer, custom={customerid}, "Customer Data", "_self");

Accepted ways of passing the parameter:

  • customerid
  • 'customerid'
  • "customerid"

Mandatory parameter, where the name of the field that will be transformed into a link to the other application must be informed.

Note: If the informed field already has a field link, the link defined in the macro will overwrite the interface link.
Application

Accepts strings with or without the protection of quotes, in addition to global or local variables.

For example: 

$var_customer = 'form_customer';

sc_link(customerid, $var_customer, custom={customerid}, "Customer Data", "_self");

Accepted ways of passing the parameter:

  • form_customer
  • 'form_customer'
  • "form_customer"
  • $var_customer
  • [glob_customer]

Required parameter, defines the target application of the call.

In this parameter it is possible to use variables making it possible to change the target application, depending on your business rule.

Parameters

This parameter defines the value of the variable that will be available from the target application as a global variable.

For example: 

sc_link(customerid, form_customer, custom={customerid}, "Customer Data", "_self");

Accepted ways of passing the parameter:

  • custom = {customerid}
  • custom = 'ALFKI'
  • custom = $var_customer
  • custom - [glob_customer]

This parameter is not mandatory, but its use is necessary for the correct display of data in the target application. When not informed, the target application will display all data in the table.

Retrieving the value in the target

application In the target application of the connection, in the example on the side is the form_customer application, the custom must be retrieved as a global variable in the application's SQL.

In this example, the following SQL statement has been added to the form (form_customer)

customerid = '[custom]'

For more details on global variable usage, access our online documentation.
Hint

Accepts string, with or without the protection of quotes, lang and global or local variables.

For example: 

sc_link(customerid, form_customer, custom={customerid}, "Customer Data", "_self");

Obs: To use commas and apostrophes in the text, it is necessary to protect with the scape "\"

Accepted ways of passing the parameter:

  • "Help text\, with a comma"
  • 'Customer
  • Data' Customer Data
  • {lang_text}
  • [glob_txt]
  • $ var_txt

This parameter is not mandatory.

Receives a text with some help or remark for the system user, the text is displayed whenever the mouse cursor passes over the link.

It is possible to use langs for the definition of messages, allowing the translation of your system.

Obs: To use commas and apostrophes in the text it is necessary to protect with the scape "\"
Target

This parameter accepts only string. Available values ​​are listed below.

For example: 

sc_link(customerid, form_customer, custom={customerid}, "Customer Data", "modal", 850, 600);

Note: If omitted, the value "_self" will be assigned.

Accepted ways of passing the parameter:

  • "_self"
  • "_blank"
  • "iframeT"
  • "iframeL"
  • "iframeR"
  • "iframeB"
  • "modal"

Defines the way to open the target application.

  • _self - Runs the target application on the same page, overlapping the query application;

  • _blank - Runs the target application on another page (pop-up);
  • iframeT - Displays the target application in an iframe above the query (Top);
  • iframeL - The target application will be displayed in an iframe to the left of the query (Left)
  • iframeR - The target application will be displayed in an iframe to the right of the query (Right);
  • iframeB - The target application will be displayed in an iframe below the query (Bot);
  • modal - Opens a new window and blocks any interaction in the main window;
When using any of the iframe or modal to open the application, it is possible to define the height and width by adding the values ​​in the optional parameters below.
Height

This parameter accepts only numerical values ​​and its unit of measurement is pixel.

For example: 

sc_link(customerid, form_customer, custom={customerid}, "Customer Data", "modal", 850, 600);

Non-mandatory parameter, available only when using the Iframe and modal parameter Target

Defines the height of the iframe or modal where the target application will be displayed.

Note: If omitted, the default value will be 440
Width

This parameter accepts only numerical values ​​and its unit of measurement is pixel.

For example: 

sc_link(customerid, form_customer, custom={customerid}, "Customer Data", "iframeB", 850, 600);

Non-mandatory parameter, available only when using the Iframe and modal parameter Target

Defines the width of the iframe or modal where the target application will be displayed.

Note: If omitted, the default value will be 630

 


Examples

Ex. 1: Creates a link to the costumer.php application, on the Id field, passing the global variable [global_costumer] as and the product field (local variable) {Id} to the costumer.php application:

sc_link(Id, costumer.php, product=[global_costumer]; Id={Id}, "Client Data", "_blank");


Ex. 2: Creating a dynamic link to another application depeding on the field valor {costumer_type} and opening it in a modal.

if ( {costumer_type} == "F") {

    sc_link (costumer_type, type_f.php, product=[global_costumer]; Id={Id}," Personal Data ", "modal", 500, 700);

} else {

    sc_link (costumer_type, type_a.php, product=[global_costumer]; Id={Id}," Company Data ", "iframeR");

}


Ex. 3: Creating a link to a URL. A redirect to the given URL will be performed.

sc_link (my_field, http://www.scriptcase.com, ,"hint of the link", "_blank");

Macro Scope

Grid application
onRecord



sc_log_add("action", "description")

This macro is intended to add a record to the log table, thereby making the message and/or the name of the action customizable to the developer. The macro parameters can use PHP variables.

 

Ex:

sc_log_add ("access", "Application has been accessed by the user trial");


Macro Scope

Blank application calendar application Grid application Form application
onExecute onValidate onScriptInit onValidate



sc_log_split({description})

This macro is intended to provide access to the information written in the last insertion in the log table, allowing the manipulation of the data before and after the record update returning it in an array mode. The information is stored in the "description" field of the log table in the string format with delimiters.

 

Ex:

$arr_description = sc_log_split({description});

Input: -> keys fields Array ( [clientid] => ANTON ) [fields] => Array ( [old] => Array ( [CEP] => 50710500 [Address] => Rua Desembargador Joao Paes 657 [City] => Farol [State] => RS ) [new] => Array ( [CEP] => 53230630 [Address] => Avenida Presidente Kennedy, 1001 [City] => Peixinhos [State] => PE ) ) )


Macro Scope

Blank application calendar application Grid application Form application
onExecute onLoad onScriptInit onLoad



sc_lookup(Dataset, "SQL Command", "Connection")

This macro allows the user to execute SQL commands and returns the result to the "dataset" variable. The "dataset" structure is an array (line/column).

The "connection" parameter is optional. Use when the command is executed in a database different from that specified for the application.
Note: The connection parameter does not accept variable. You must enter the name of the connection that the SQL command will execute.


Ex. 1:
sc_lookup(dataset, "select customer_id, customer_name, credit_limit from customers" );

To have access to the first line (Dataset), use :
{customer_id} = {dataset[0][0]};
{customer_name} = {dataset[0][1]};
{credit_limit } = {dataset[0][2]};

To have access to the second line (Dataset), use:
{customer_id} = {dataset[1][0]};
{customer_name} = {dataset[1][1]};
{credit_limit} = {dataset[1][2]};

If occurs error in the execution of the SQL command, the variable attributed to the dataset will return as "false" and the error message will be available in the "dataset_error" variable. It is also important to verify the select returned data, to prevent access to non-existent variables, once the output array only will be created if the select command returns data.


Ex. 2:
sc_lookup(my_data, "select customer_id, customer_name, credit_limit from customers");
if ({my_data} === false)
{
echo "Access error. Message=". {my_data_error} ;
}
elseif (empty({my_data}))
{
echo "Select command didn't return data";
}
else
{
{customer_id} = {my_data[0][0]};
{customer_name} = {my_data[0][1]};
{credit_limit} = {my_data[0][2]};
}



Ex. 3:
The SQL command also can be composed of application fields (local variables) or of global variables:
sc_lookup(dataset, "select order_value from orders where clientid = '{customer_id} ' and salesman_id = [var_glo_salesman]");

Note: The command must always be finished with a semicolon ";".

Note2: For a big result returned in the dataset we recommend the use of the macro sc_select instead of this one.


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onCalendarScriptInit
onScriptInit
onLoad
onRefresh
onValidate
onValidateSuccess
onFooter
onHeader
onScriptInit
onClick
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateSuccess
onBlur
onChange
onClick
onFocus
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onFooter
onHeader
onScriptInit
onRecord



sc_lookup_field(Dataset, "SQL Command", "connection_name")

This macro allows the developer to execute a SELECT command at a time and have access to the data returned through the dataset parameter, in array format: {dataset[line_number][field_name]}.
To run commands that return a large amount of data, we recommend using sc_select macro for better performance.

Unlike the macro sc_lookup, where we inform the index {dataset[0][0]}, in the macro sc_lookup_field we must inform the name of the column that we want to retrieve the data {dataset[0][field_name]}

The way of assembling the return array, where we must inform the column name, makes this macro incompatible with the following databases: MSSQL Server, Access and DB2. In these cases, we recommend using the sc_lookup macro.

See below for details on the macro parameters.

Parameter Description Examples
dataset

This parameter is mandatory and must be informed without spaces or special characters and does not accept variables.

It defines the name of the variable that will receive the return of the SELECT command executed by the macro.

 

In case of error in the execution of the SQL command, this parameter will return false and the error message will be available in the variable "dataset_erro".

Below is a simple example of validation and error message display.

if ( {meus_dados} === false ) {

echo "Access error. Message = " . {meus_dados_erro};

}
sc_lookup_field("my_dataset", "select field_01, field_02, field_03 from tb_name");

When executing the command print_r({my_dataset}); we will get the following return:

 Array (
    [0] => Array (
            [field_01] => 1
[field_02] => OFFICE EQUIPMENT ) [1] => Array ( [field_01] => 2
[field_02] => FIXED TELEPHONY
)
)

In the example above, the command returned two record lines and in each line two columns (field_01 and field_02).


The recovery of the value should take place as follows.

{my_dataset[line_number][colunm_name]}

SQL Command

This parameter is mandatory and can be defined by informing the command directly in the macro protected with quotes (double or single) or using a variable (local or global).

// Command directly in the Macro
sc_lookup_field("retorno_select", "select field_01, field_02, field_03 from tb_name");
// Sample with variable 
$comando_select = "select field_01, field_02, field_03 from tb_name"
sc_lookup_field("retorno_select", $comando_select);
Connection

The "connection" parameter is optional, and must be informed if the command is executed in a database different from the one specified for the application.

Furthermore, this parameter does not accept the use of variables, being necessary to type the name of the connection for the macro to run correctly.

// Sample of using the connection parameter
sc_lookup_field("retorno_select", "select field_01, field_02, field_03 from tb_name", "nome_conexao");

 

Examples


Example 1: Access multiple lines

sc_lookup_field(my_dataset, "select field_01, field_02, field_03 from tb_name");

//To access the first line (dataset), we must inform:
{field_01} = {my_dataset[0]['field_01']};
{field_02} = {my_dataset[0]['field_02']};
{field_03} = {my_dataset[0]['field_03']};

/To access the second line (dataset), we must inform:
{field_01} = {my_dataset[1]['field_01']};
{field_02} = {my_dataset[1]['field_02']};
{field_03} = {my_dataset[1]['field_03']};

 

Example 2: With data validation:

$comando_sql = "select field_01, field_02, field_03 from tb_name";

sc_lookup_field(my_dataset, $comando_sql);

if ( {my_dataset} === false ) {

echo "Access error. Message = " . {my_dataset_error};

} elseif ( empty({my_dataset}) ) {

echo "select command did not return data ";

} else {

{clienteid} = {my_dataset[0]['field_01']};
{nomecliente} = {my_dataset[0]['field_02']};
{limitecred} = {my_dataset[0]['field_03']};

}

 

Example 3: Using the connection parameter

$comando_sql = "select field_01, field_02 from tb_name where field_03 = '{field_03} ' and field_02 = [var_global]"

sc_lookup_field(my_dataset, $comando_sql, "conn_name");

 

Example 4: Using local and global variables in the macro command

$comando_sql = "select field_01, field_02 from tb_name where field_03 = '{field_03} ' and field_02 = [var_global]"

sc_lookup_field(my_dataset, $comando_sql);

Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onCalendarScriptInit
onScriptInit
onLoad
onRefresh
onValidate
onValidateSuccess
onFooter
onHeader
onScriptInit
onClick
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateSuccess
onBlur
onChange
onClick
onFocus
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onFooter
onHeader
onScriptInit
onRecord



sc_mail_send(SMTP, Usr, Pw, From, To, Subject, Message, Mens_Type, Copies, Copies_Type, Port, Connection_Type, Attachment, SSL)

This macro is used to send emails.

Parameter
Description
SMTP SMTP server name or IP address. (String or Variable that contains the server name)
Usr SMTP username. (String or Variable that contains the username)
Pw SMTP password. (String or Variable that contains the password)
From From email. (String or Variable that contains the email)
To List of the emails that will receive the message, it could be a string or variable that contains one or more emails separated by ";" or one variable that contains one array of emails.
Subject Message subject. (String or Variable that contains the subject)
Message Message body. (String or Variable that contains the message)
Mens_Type Message format: (T) Text or (H) HTML.
Copies List of the emails that will receive the message, it could be a string or variable that contains one or more emails separated by ";" or one variable that contains one array of emails.
Copies_Type Type copies: BCC (Hidden copies) or CCC (Regular copies).
Port The port used by your e-mail server. Use the port 465 for the security type SSL, and the port 587 for the security type TLS or the port 25 for no security. If not informed, Scriptcase will set the default port: 25
Connection_Type Indicating a secure connection. Use S for SSL, T for TLS or N for non-secure connections. If not informed, Scriptcase will set the default value:N.
Attachment Absolute path of the file that will be attached in the email
SSL Optional parameter to add SSL settings. If you need to add more than one setting, use ";" for separate them. Ex: $ssl = 'allow_self_signed=false;verify_peer=false';
Reply_to It is the email address the reply message is sent to, when you want the reply to go to an email address other than the From address.

Note: To use safe connection its required to have the PHP "php_openssl" extension enable.

 

Example 1: Sending e-mail with reply_to parameter

To use the replay_to parameter, you must include all the other parameters before it, just inform them empty.

sc_mail_send('smtp.meuserver.com.br', 'usr', 'pw', 'from@netmake.com.br', 'to@netmake.com.br', 'test sending
of e-mail', 'message', 'H', 'abc@cop.com.br;zxy@cop.com.br', 'CCC', '587', '', 'c:/teste/arq .txt','','reply@netmake.com.br');

Example 2: Using variables and defining the port.

sc_mail_send([glo_smtp], [usuar], [glo_pw], {from}, {to}, {subject}, {message}, 'T', [glo_copias], 'CCC', '419', 'S', {attached});

 

Example 3: No user and password.

The amount of emails sent will be stored at the special variable sc_mail_count.
If any error happens when the Scriptcase try to send the email, the variable sc_mail_ok will receive "false" and the error message will be stored on the variable sc_mail_erro.

sc_mail_send([glo_smtp], '', '', 'from.netmake.com.br', {to}, {subject}, {message}, 'H', '', '', '', '', [glo_att]);

 

Example 4: Email validation with {sc_mail_ok}

sc_mail_send([glo_smtp], '', '', 'from@netmake.com.br', {to}, {subject}, {message}, 'H');

if ({sc_mail_ok}) {

echo "sent {sc_mail_count} e-mail(s) with success!!";

} else {

sc_error_message({sc_mail_erro});

}

 

Example 5: Sending attached files

//Defining macro parameters in variables
$mail_smtp_server   = 'smtp.gmail.com';  // SMTP Server
$mail_smtp_user = 'doc@gmail.com.br'; // SMTP access user
$mail_smtp_pass = 'password'; // Password for the SMTP user entered above
$mail_from = 'doc@gmail.com.br'; // Message origin email
$mail_to = 'doc@gmail.com.br'; // Email of message recipient
$mail_subject = 'Subject'; // Email subject
$mail_message = 'Email body'; // Email body
$mail_format = 'T'; // Email body format: T (Text only) or H (For text and HTML)
$mail_copies = ''; // Parameter that defines the copied emails.
$mail_tp_copies = ''; // Copy type: BCC (For blind copy) or CCC (For normal copy)
$mail_port = '465'; // Sending server port
$mail_tp_connection = 'S'; // Use or not of secure connection: Y (Secure connection) or N (Insecure connection)
$mail_attachments = 'c:/teste/arq.txt' // Directory of the file that will be sent as an attachment //Macro with variables sc_mail_send($mail_smtp_server, $mail_smtp_user, $mail_smtp_pass, $mail_from, $mail_to, $mail_subject, $mail_message, $mail_format, $mail_copies, $mail_tp_copies, $mail_port, $mail_tp_connection, $mail_attachments);

 

Example 6: Sending multiple files as attachments

//Parâmetros do e-mail
$mail_smtp_server   = 'smtp.gmail.com':   // SMTP Server
$mail_smtp_user = 'doc@gmail.com.br'; // SMTP access user
$mail_smtp_pass = 'password'; // Password for the SMTP user entered above
$mail_from = 'doc@gmail.com.br'; // Message origin email
$mail_to = 'doc@gmail.com.br'; // Email of message recipient
$mail_subject = 'Subject'; // Email subject
$mail_message = 'Email body'; // Email body
$mail_format = 'T'; // Email body format: T (Text only) or H (For text and HTML)
$mail_copies = ''; // Parameter that defines the copied emails.
$mail_tp_copies = ''; // Copy type: BCC (For blind copy) or CCC (For normal copy)
$mail_port = '465'; // Sending server port
$mail_tp_connection = 'S'; // Use or not of secure connection: Y (Secure connection) or N (Insecure connection)
// Array of the file that will be sent as an attachment. $mail_attachments = array('C:\Program Files\NetMake\v9-php81\wwwroot\scriptcase\file\img\color.png','C:\Program Files\NetMake\v9-php81\wwwroot\scriptcase\file\img\test.txt'); //Macro with variables sc_mail_send($mail_smtp_server, $mail_smtp_user, $mail_smtp_pass, $mail_from, $mail_to, $mail_subject, $mail_message, $mail_format, $mail_copies, $mail_tp_copies, $mail_port, $mail_tp_connection, $mail_attachments);

Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute onAfterDelete
onAfterInsert
onAfterUpdate
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onFooter
onHeader
onScriptInit
onClick
onHeader
onScriptInit
onRecord
onFilterInit
onFilterSave
onFilterValidate
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onFooter
onHeader
onScriptInit
onRecord



sc_make_link(Application, Parameters)

This macro creates a string containing a link to other Scriptcase applications (when writing HTML code).

Parameter
Description
Application Name of the application to establish the link.
Parameters Parameters necessary so-called application. In the format: "=" (the attribution sign) . More than one parameter must be separated by ";" (semicolon).



Ex. 1: Creating a string with a link for the datacli.php application, without parameters passage.

$string_link = sc_make_link(datacli.php);



Ex. 2: Creating a string with a link for the application datacli.php, with parameters passage.

$string_link = sc_make_link(datacli, parm1={company};parm2=[glo_office]);


Macro Scope

Blank application chart application Grid application Control Form
onExecute onFooter
onHeader
onScriptInit
onScriptInit
onNavigate
onRecord
onValidate
onValidateSuccess



sc_master_value("Object", "Value")

Update data in the master application, in real-time, according to changes made in a given field of the detail application.

Parameter
Description
Object Object name to be updated in the master Application. It's not necessary the {} in a field name.
Value Object value. The value can be a field or a variable.



Ex. 1:

sc_lookup(result,"SELECT SUM(Total) FROM adm_order_itens WHERE OrderID = '{OrderID}'");

//Using sc_format_num() to format the value that will be updated in the master application
$value = sc_format_num({result[0][0]}, ',', '.', 2, 'S', 1, '');
sc_master_value('OrderPrice', $value);

* If the value, that will be sent to the master, be numeric, you have to use the sc_format_num() to format it. To see the macro documentation, click here.


Macro Scope

calendar application Form application Control Form
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onScriptInit
onLoadAll
onRefresh



sc_menu_delete(Id_Item1)

This macro removes menu items passed as parameters. It can be used in menu applications or tree menu.

Observe that the parameters used in this macro are the "ID" of the items.

If a menu item is removed and it has "nodes", they will be hidden too.


Macro Scope

Menu application Responsive Menu Tree menu
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onLoad



sc_menu_disable(Id_Item1)

This macro deactivates menu items passed as parameters. Can be used in menu applications or tree menus.

The parameters passed are items �ID�. Menu items are deactivated recursively (when a submenu item is deactivated its �nodes� are also deactivated).


Macro Scope

Menu application Responsive Menu Tree menu
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onLoad



sc_menu_force_mobile(boolean)

This Macro is used to force the creation of menus to mobile devices.

The parameter (true or false) is optional. If no value is passed, it will use the value "true" ( enable mobile mode)

�

Ex1:

sc_menu_force_mobile(true);

Ex2:

sc_menu_force_mobile(false);


Macro Scope

Menu application Responsive Menu Tree menu
onLoad onLoad onApplicationInit
onLoad



sc_menu_item

This macro is only available for menu applications and it has the objective of giving access to a menu item that was selected, this way the user can take decisions before running the application.

�

Ex. 1: To clean global variable.
if ({sc_menu_item} == "item_1")
{
sc_reset_global([global1], [global2]);
}


Ex. 2: If an application requires a global variable another application can initialize it accordingly.
if ({sc_menu_item} == "item_5" && (!isset([glo_employ]) || empty([glo_employ])))
{
sc_redir(apl_inf_emp);
}

�


Ex. 2: Use the button on the toolbar menu.

if ({sc_menu_item} == "btn_1")
{
sc_apl_conf("form_customer", "start", "new");
}

�


Macro Scope

Menu application Responsive Menu Tree menu
onExecute onExecute onApplicationInit
onExecute



sc_redir('app_name/url', parameter01; parameter02, 'target', 'error', 'modal_height', 'modal_width')

The sc_redir macro is used to create dynamic redirects between two applications or between an application and a URL, allowing the passing of parameters and control over how the destination application will be opened using the target parameter.

In form applications, the sc_redir macro can be used in events that depend on database updates, such as: onAfterInsert, onAfterUpdate, onAfterDelete, onBeforeInsert, onBeforeUpdate, and onBeforeDelete.
However, in these events, the sc_commit_trans() macro must be used before sc_redir to confirm the transaction; otherwise, the redirection will occur without the table changes being applied.

Parameters

Parameter Description Examples
app_name/url Receives the name of the destination application or URL to which the user will be redirected.
The values must be enclosed in double or single quotes.
sc_redir('app_name');
parameter_to_send

Allows passing values to the destination application in the format: parameter_name='value'.
You can use a application_field, variable or informa a fixed value.

If more than one parameter is passed, use a semicolon (;) as a delimiter.
Values should be retrieved as global variables in the destination application.

sc_redir('app_name', parm1=50);

Two parameters passed: sc_redir('aplx', parm1={clienteid}; parm2="xxx");
In 'aplx', values retrieved as global variables: [parm1] and [parm2].

target

Defines how the destination application/URL will be displayed.

  • _self: Opens the destination in the same tab (default if no value is specified).
  • _blank: Opens the destination in a new tab.
  • _parent: Opens the destination in the parent window, if the current page is in an iframe.
  • modal: Opens the destination in a modal window (this option is unavailable when using the macro in a Run button)
Specifying target without parameters:
sc_redir('app_name', , '_blank');

Using modal:
sc_redir('app_name', , 'modal', , '800', '600');
error Defines the behavior of the redirection in case of an error in the application.
  • 'E': Blocks the redirection if an error occurs.
  • 'F': Forces the redirection even if an error occurs.
sc_redir('app_name', , ' ', 'E');
modal_height Defines the height of the modal in pixels. This parameter is mandatory when using modal in the target parameter. sc_redir('app_name', , 'modal', , '800', '600');
modal_width Defines the width of the modal in pixels. This parameter is mandatory when using modal in the target parameter. sc_redir('app_name', , 'modal', , '800', '600');

 

Usage Examples


Example 1 - Simple redirection without parameters.
//Since only the application was specified, it will open in the same tab.
sc_redir('aplx');
Example 2 - Redirection with parameter passing.
//Four parameters are being sent to the destination application; these values must be retrieved as global variables: [parm1][parm2][parm3][parm4].
if (empty($variable)) { $variable = "documentation"; }
sc_redir('aplx', parm1={clienteid}; parm2="xxx"; parm3=$variable; parm4=10);
Example 3 - Using target without parameters.
//In this case, since no parameters are being sent to the destination application, the space should be left blank to specify the target.
sc_redir('aplx', , '_blank');
Example 4 - Using modal for the target parameter.
//It is mandatory to define the width and height when specifying modal in the target parameter.
//Only the values should be provided.
sc_redir('aplx', , "modal", '', '800', '600');
Example 5 - Example of use in form database transaction events.
//The sc_commit_trans macro must be used before sc_redir to confirm the transaction.
sc_commit_trans();
sc_redir('aplx', parm1={clienteid});
Example 6 - Redirection to a URL.
if ([glo_usr] == "test")
{
sc_redir(http://www.mypage.com.br);
}

Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onCalendarApplicationInit
onCalendarScriptInit
onScriptInit
onLoad
onValidate
onValidateSuccess
onApplicationInit
onScriptInit
onClick
onApplicationInit
onScriptInit
onFilterInit
onFilterValidate
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onValidate
onValidateSuccess
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onExecute
onLoad
onApplicationInit



sc_reset_apl_conf("Application", "Property")

This macro has the objective to delete all modifications effected by the sc_apl_conf macro.
The property parameter its optional, if it's passed it will only erase the modification from that specific application.


Ex. 1: Deleting the modifications of the "my_application" application, property "start".
sc_reset_apl_conf("my_application", "start");



Ex. 2: Deleting the modifications of the "my_application" application.
sc_reset_apl_conf("my_application");



Ex. 3: Deleting the modifications of all the applications.
sc_reset_apl_conf();


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute onApplicationInit
onCalendarApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onFilterInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onValidate
onValidateSuccess
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onScriptInit



sc_reset_apl_default

 

This macro should be used when necessary to remove sc_apl_default() macro control over the applications.

Ex1:

sc_reset_apl_default();


Macro Scope

calendar application chart application Grid application Form application Control Form ReportPDF application
onScriptInit onScriptInit onScriptInit onScriptInit onScriptInit onScriptInit



sc_reset_apl_status

This macro has the objective to clean all security variables, set through the sc_apl_status macro.

 

Ex. 1:

sc_reset_apl_status();


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute onApplicationInit
onCalendarApplicationInit
onCalendarScriptInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onFilterInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onValidate
onValidateSuccess
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onScriptInit



sc_reset_change_connection

This macro has the objective to erase the changes made using the macro "sc_change_connection".

 

Ex. 1:

sc_reset_change_connection();


Macro Scope

Blank application calendar application chart application Grid application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute onApplicationInit
onCalendarApplicationInit
onCalendarScriptInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onValidate
onValidateSuccess
onApplicationInit
onLoad
onApplicationInit
onLoad
onLoad onScriptInit



sc_reset_connection_edit

This macro undoes the connection edits made by macro "sc_connection_edit".

 

Ex. 1:

sc_reset_connection_edit();


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onCalendarApplicationInit
onCalendarScriptInit
onScriptInit
onLoad
onValidateSuccess
onApplicationInit
onFooter
onHeader
onScriptInit
onScriptInit onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onExecute
onLoad
onApplicationInit
onFooter
onHeader
onScriptInit
onRecord



sc_reset_connection_new

This macro undoes the connections made by the macro "sc_connection_new".

sc_reset_connection_new();


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onCalendarApplicationInit
onCalendarScriptInit
onScriptInit
onLoad
onValidateSuccess
onApplicationInit
onFooter
onHeader
onScriptInit
onScriptInit onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onExecute
onLoad
onApplicationInit
onFooter
onHeader
onScriptInit
onRecord



sc_reset_global([Global_Variable1], [Global_Variable2] ...)

This macro is used to delete global variables, stored in the PHP session.

 

Ex. 1:

sc_reset_global ([Login], [Pass]);


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onCalendarApplicationInit
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onFooter
onHeader
onScriptInit
onClick
onApplicationInit
onGroupBy
onHeader
onScriptInit
onRecord
onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onLoad onApplicationInit
onFooter
onHeader
onRecord



sc_reset_menu_delete

This macro its used to restore a menu item, deleted by the macro "sc_menu_delete".

 

Ex. 1:

sc_reset_menu_delete();


Macro Scope

Menu application Responsive Menu Tree menu
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onLoad



sc_reset_menu_disable

This macro has the objective to enable a menu item, disabled by the macro "sc_menu_disable".

 

Ex. 1:

sc_reset_menu_disable();


Macro Scope

Menu application Responsive Menu Tree menu
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onLoad



sc_rollback_trans("Connection")

Watch a tutorial



This macro is used to cancel a transaction set in the database.

The "Connection" parameter is optional, use only if the command is executed in a different data base from the specified to the application.


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onHeader
onScriptInit
onClick
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onClick
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onExecute
onLoad
onHeader
onRecord



sc_script_name

This macro is available to the MENU applications to access the application name that was selected in the menu. It allows the user to make decisions before executing the application if a pre-process is required to that application.


Ex. 1: To clean global variables.
if ({sc_script_name} == "apl1")
{
sc_reset_global([global1], [global2]);
}


Macro Scope

Menu application Responsive Menu Tree menu
onExecute onExecute onExecute



sc_select(dataset, "SQL Command", "Connection")

This macro executes the SQL commands passed as parameter and access the "dataset" in the command.

Different from sc_lookup macro, this macro doesn't manipulate the dataset (the user is responsible for all the manipulation).

If an error occurs in the sql command execution, the variable attributed to the database returns as "false" and the error message is available in the "dataset_error" variable.

The connection parameter is optional, use only if the command is executed in a data base different from the specified in the application. In this parameter it is not possible to use variables.


Ex. 1:

sc_select(my_data, "select clientId, clientName, limitecred from costumers");
if ({my_data} === false)
{
echo "Access error. Message =". {my_data_erro};
}
else
{
while (!{my_data}->EOF)
{
{clientName} = {my_data}->fields[1];
{my_data}->MoveNext();
}
{my_data}->Close();
}



Ex. 2: The SQL command can passed as application fields (local variables) or of global variables.
sc_select(dataset,"select price order from order where clientId = '{clientId}' and cod_Seller = [var_glo_seller]");

Note: The command must always be finished with semicolon";".


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onCalendarScriptInit
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onFooter
onHeader
onScriptInit
onClick
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onExecute
onLoad
onFooter
onHeader
onRecord



sc_select_field({Field})

This macro modify dynamically the SELECT:
Is possible to modify dynamically the grid fields through the dynamic modification of the original select.


Ex. 1:
A table with the columns year and the months from January to December is used to create a grid using a parameter, displays the years and only a specific month. Passing the parameter as a global variable named "show_month", in the application is found the following structure:

Select Clause: select year, pair_month from table

sc_select_field(pair_month) = [show_month];
sc_label(pair_month) = [show_month];
Modify the select, and the grid column label.

It is possible, during the grid execution time, modify the grid ORDER BY clause.
At least one ORDER BY is required in the original grid SQL command to allow the substitution execution during the grid time.

 

Ex. 2: Select Clause: select code, name, value from table order by code. To change the order, from code to name, use: sc_select_order("code") = "name";

Note: This command must be in the context of the event "onInit";


Macro Scope

chart application Grid application
onScriptInit onScriptInit



sc_select_order("Field")

It is possible, during the grid execution time, to modify the grid ORDER BY clause.
At least one ORDER BY is required in the original grid SQL command to allow the substitution during the grid execution time.



Ex. 1: Select Clause: SELECT code, name, price FROM table ORDER BY code
To change the order from code to name, we will have:
sc_select_order("code") = "name";



Ex. 2: Select Clause: SELECT code, name, price, date FROM table ORDER BY code, name, price
To change the order from name to date, we will have:
sc_select_order("name") = "date";


Note:
This command must be in the context of "process before the select".


Macro Scope

chart application Grid application
onScriptInit onHeader
onScriptInit



sc_select_where(add)

This is possible, during grid execution time to add a field/condition to the search WHERE clause.

Ex. 1: It adds the content between the quotes (") in the grids select.
if (empty({sc_where_current}))
{
sc_select_where(add) = "where campoX > [global]";
}
else
{
sc_select_where(add) = "AND campoX > [global_variable]";
}

Note: This command must be in the context of "process before the select".


Macro Scope

chart application Grid application
onScriptInit onHeader
onScriptInit



sc_send_mail_api($arr_settings)

This macro allows dynamic sending of embedded emails with the Mandrill and Amazon SES APIs. It is also possible to send e-mail using the SMTP protocol.

This macro uses the same mandrill parameters to send e-mail, regardless of the Gateway (Changer, Amazon SES or SMTP) selected. click here and see the list of parameters that can be used.

This macro contains a single parameter "$arr_settings", which receives an array with the email sending information.

For more information on the parameters the mandirll click here

.

Parameter
Description
$arr_settings Array with information for use of APIs.

 

Array indices
Description
profile Name of some API already configured in "Tools> API", as can be seen in Example 1. When informing a profile, the settings index should not be informed.
settings E-mail sending server settings. The information must conform to the API used. Note: When informing the settings, the Profile index is disregarded.
message Message that will be sent by email. Subject, body, to, etc.

 

Example 1: Sending e-mail using a pre-configured Profile in "Tools> API".

if({api_type} == 'smtp' ){
	$var_config = array(
		'profile' => 'yahoo_example',

		'message' => [
			'html'          => {email_body},
			'text'          => '',
			'to'            => $arr_merge,
			'subject'       => {subject}
		]
	);
}

sc_send_mail_api($var_config);

 

Example 2: Sending e-mail via SMTP

$smtp_server = "smtp.mail.yahoo.com";
$smtp_port = "465";
$smtp_user = "scriptcase.export";
$smtp_password = "scriptcase.export";
$from_email = "scriptcase.export@yahoo.com";
$from_name = "Scriptcase Export";

if ( {api_type} == 'smtp' ){
	$var_config = array(

		'profile' => '',

		'settings' => [
				'gateway'       => 'smtp',
				'smtp_server'   => $smtp_server,
				'smtp_port'     => $smtp_port,
				'smtp_user'     => $smtp_user,
				'smtp_password' => $smtp_password,
				'from_email'    => $from_email,
				'from_name'     => $from_name
		],

		'message' => [
				   'html'          => {email_body},
				   'text'          => '',
				   'to'            => $arr_merge,
				   'subject'       => {subject}
		]
	);
}

sc_send_mail_api($var_config);

 

Example 3: Sending email using Mandrill API

if({api_type} == 'mandrill' ){
	$var_config = array(
		'settings' => [
				   'gateway'       => 'mandrill',
				   'api_key'   	   => {api_key},
				   'from_email'    => {from_email},
				   'from_name'     => {from_name}
		],

		'message' => [
				   'html'          => {email_body},
				   'text'          => '',
				   'to'            => array($arr_merge),
				   'subject'       => {subject}
		]
	);
}

sc_send_mail_api($var_config);

 

Example 4: Sending email using Amazon SES API

if({api_type} == 'ses' ){
	$var_config = array(
		'settings' =>  [
	        'gateway' => 'ses',
	        'region' => {ses_region},
	        'api_key' => {api_key},
	        'api_secret' => {ses_secret},
	        'from_email'    => {from_email}
	    ],
	    'message' => [
	        'html'          => {email_body},
	        'text'          => '',
	        'to'            => array($arr_merge),
	        'subject'       => {subject}
	    ]
	);
}

sc_send_mail_api($var_config);

Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Tree menu ReportPDF application
onExecute onAfterDelete
onAfterInsert
onAfterUpdate
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onFooter
onHeader
onScriptInit
onClick
onHeader
onScriptInit
onRecord
onFilterInit
onFilterSave
onFilterValidate
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onFooter
onHeader
onScriptInit
onRecord



sc_send_notification('title', 'message', 'destiny_type', 'to', 'from', 'link', 'dtexpire', 'profile')

The macro sc_send_notification allows sending notifications to system users dynamically.

 

Parameter Description

Parameter Description Example
title =>

Mandatory parameter that receives the title of the notification that will be sent.

The text can be provided in quotes, using variables or langs.

Using variable
$title_not = "message title";
'title' => $title_not

Direct text in the macro or with lang
'title' => 'message title' or 'title' => {lang_notification_title} 

message =>

Mandatory parameter that receives the body of the notification message that will be sent.

This parameter allows the use of texts with or without HTML formatting and can be provided in quotes, variables, or lang.

Using variable
$msg_not = "Notification message body";
'message' => $msg_not

Direct text in the macro
'message' => 'Notification message body'

destiny_type =>

Mandatory parameter that defines what data must be provided in the to parameter for sending the notification.

The values that must be provided are:

  • 'user' - Defines that the to parameter must receive the login of the users who should receive the notification message.
  • 'group' - Defines that the to parameter must receive the names of the groups, from the security module, that should receive the notification message. This option is only available in systems that use the security module by group.
  • 'all' - Defines that all system users should receive the notification message. In this case, the to parameter must be passed as empty.
  • 'profile' - Defines that the to parameter must receive the names of the profiles created in the notification system, in the Send Notification application, that should receive the message.
Example of how the parameter should be provided
'destiny_type' => 'user'

Accepted values are: user, group, all and profile
to =>

Defines the system users who should receive the notification, within the universe defined in the destiny_type parameter.

  • When specifying destiny_type =>'user' - The developer must provide a list of the logins of the users who should receive the notification. The provided values must be separated by semicolons (;).
  • When specifying destiny_type => 'group' - The developer must provide the list of user groups, from the security module, that should receive the notification.
  • When specifying destiny_type => 'all' - In this case, all system users should receive the notification, and the to parameter must receive an empty value.
  • destiny_type => 'profile' - The developer must provide the names of the profiles created in the notification system, in the Send Notification application, that should receive the message.

In all cases, the provided values must be separated by semicolons (;)

Example when using destiny_type =>'user'
'to' => 'joao;pedro;carlos'

Example when using destiny_type =>'group'
'to' => 'employees;administrators'

Example when using destiny_type =>'all'
'to' => ''

Example when using destiny_type =>'profile'
'to' => 'sending_group_name1;sending_group_name2'

from =>

Mandatory parameter that defines the system user sending the notification.

This parameter accepts only one value at a time and can be defined by directly providing a user's name or through a variable.

'from' => 'admin'
link =>

Optional parameter that receives a link to access an application in the system or an external URL.

The text can be provided in quotes, using variables.

Providing an external URL
'link' => 'https://scriptcase.com.br/'

Providing an application from the system
'link' => 'app_name'

dtexpire =>

Optional parameter that defines the date and time when the notification will expire and will no longer be displayed in the quick access icon of the menu. Upon reaching the date, the user will only be able to access the message through the inbox application.

The date and time format must be: YYYY-MM-DD HH:MM:SS

'dtexpire' => '2024-10-02 23:59:59'
profile =>

Mandatory parameter that must receive the name of the profile that the developer specified when creating the notification module in the Scriptcase interface.

'profile' => 'samples_notification'

 

Example

$title = 'New user';
$msg = 'User: ' . $struser . ' registered in the system';

sc_send_notification([
    'title' => $title,
    'message' => $msg,
    'destiny_type' => 'user',
    'to' => 'admin',
    'from' => 'admin',
    'link' => '',
    'dtexpire' => '2024-10-02 23:59:59',    
  'profile' => 'samples_profile_name',
]);

 


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onCalendarApplicationInit
onCalendarScriptInit
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onFooter
onHeader
onScriptInit
onClick
onApplicationInit
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onFooter
onHeader
onScriptInit
onRecord



sc_send_sms($arr_settings)

This macro receives an array as the configuration parameter that contains the message, recipient, gateway, and API key.

Parameter Description
$arr_settings Array with the information for use in the macro.

 

Array Index Description
to: SMS recipient
message: The content of the text message
gateway: API to be used (clickatell, plivo or twilio)
auth_token: API Authentication Token


Sample 1 - Basic sending Structure:

$arr_settings = array(
	'message' => 
	[
		'to' => '+55999999999',
		'message' => 'Scriptcase SMS'
	],
	'settings' => 
	[
		'gateway' => 'clickatell',
		'auth_token' => '54Cik1-gQ4GqtuN70d4y4w=='
	]);

sc_send_sms($arr_settings);
 

Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onCalendarApplicationInit
onCalendarScriptInit
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onFooter
onHeader
onScriptInit
onClick
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onFooter
onHeader
onScriptInit
onRecord



sc_seq_register

This macro provides the record (being processed) grid sequential number. It can be used, only in onRecord event.

 

Ex. 1:
if({sc_seq_register} == 10) {
// last line of the page
{total} = {sum_total};
}


Macro Scope

Grid application
onRecord



sc_set_export_name ("export_type", "file_name")

The files resulting from the exports made in the query are stored in thedirectory tmp (temporary)specified in the tool's settings.

Both in development and in production, files are stored with theprefix sc_ and a unique key. After a while, files with the prefix sc_ will be deleted.

 

To prevent the exported files from being deleted, it is possible to use this macro to rename them.

Parameter List

Parameter

Value

Description

"export_type"

String containing the export type, which must be protected by quotation marks.


  Example of use in the macro.

   "csv"

 List of supported values:

  • csv
  • json
  • pdf
  • rtf
  • xml
  • xls
  • word

Mandatory parameter, where we must inform the type of file we want to rename.


This parameter does not accept variables.

"filename"

String containing the name the file will receive.

Example of use in the macro:

"New file name"

Supported values

  • String with the name
  • Global variable

Mandatory parameter, where we must inform the name that the file will receive.

 

See below some examples of using the macro:

Example 1 - Defining a name for a PDF file

sc_set_export_name ("pdf", "meu_arquivo_pdf.pdf");

 

Example 2 - Defining a file name by passing the value through a global variable.

sc_set_export_name ("json", [glo_nome_json]);


Macro Scope

chart application Grid application
onScriptInit onApplicationInit
onScriptInit



sc_set_fetchmode(parm);

This macro allows to change the type of return from the dataset of the select commands.
The macro will processed before running the SQL command. Informing the parameter, the dataset will return the index or the name of the column.

parm = 0 : Returns an array with the index and the name of columns (Scriptcase's Default)
parm = 1 : Returns an array only with indexes of the columns

Example 1: Returning an array with the name of the columns.

sc_set_fetchmode(0);
sc_select(my_data, "SELECT customerid, stateid, birthdate, creditlimit FROM customers where customerid = 'ALFKI'");

while (!$my_data->EOF){
$meus_dados->fields['customerid'];
$customer = $my_data->fields['stateid'];
$customer = $my_data->fields['birthdate'];

$my_data->MoveNext();
}
$my_data->Close();

--------------------------------------------------------------------------------------

Example 2: Returning an array with the index of the columns.

sc_set_fetchmode(1);
sc_select(my_data, "SELECT customerid, stateid, birthdate, creditlimit FROM customers where customerid = 'ALFKI'");

while (!$my_data->EOF){
$my_data->fields[1];
$customer = $my_data->fields[2];
$customer = $my_data->fields[3];

$my_data->MoveNext();
}
$my_data->Close();


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onFooter
onHeader
onScriptInit
onClick
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onExecute
onLoad
onExecute
onLoad
onExecute
onLoad
onFooter
onHeader
onScriptInit
onRecord



sc_set_focus('Field')

This macro is used to set the focus to a specific field in a form application.

 

Ex. 1:

sc_set_focus('name');


Macro Scope

calendar application Form application Control Form
OnClick
onLoad
onRefresh
onValidateSuccess
OnClick
onLoad
onRefresh
onValidateSuccess
onApplicationInit
onScriptInit
onLoadAll
onRefresh



sc_set_global($variable_01) or ({My_Field})

This macro is used to register global variables. Create a session variable with the same name and content of the local variable.

NOTE: This macro will be discontinued soon. You should use the method of creating global variables using brackets. Ex: [var_glo_user] = "test";


Ex. 1: Registering a users variable.
$my_var = "mary";
sc_set_global($my_var);

Creates a session variable with the name "my_var" with the "mary" content.

�

Ex. 2: To register a field value as a session variable.
sc_set_global({fieldname});

Note: This macro doesn't attribute values. Only register the session variables from PHP.


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Responsive Menu Tree menu ReportPDF application
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onCalendarApplicationInit
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onFooter
onHeader
onScriptInit
onClick
onApplicationInit
onFooter
onGroupBy
onHeader
onScriptInit
onRecord
onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onFooter
onHeader
onScriptInit
onRecord



sc_set_groupby_rule

This macro is used to select a GROUP BY rule in execution time in the onApplicationInit event.

 

Ex:

sc_set_groupby_rule = "rule id";


Macro Scope

Grid application
onApplicationInit



sc_set_language('String Language')

This macro allows us to define the application language dynamically.

 

Ex. 1: Changes the language to English.
sc_set_language('en_us');



Ex. 2: Changes the language to Spanish.
sc_set_language('es');

 

It still allows to define the language and regional settings of the applications using a delimiter ";" between the parameters.

 

Ex. 1: Changing the language to English and regional settings to Canada.
sc_set_language('en_us;en_ca');



Ex. 2:
Changing the language to Spanish and regional settings to Mexico.
sc_set_language('es;es_mx');



Ex. 3:
Changing the language to Germanian and regional settings to Luxembourg.
sc_set_language('de;de_lu');



Ex. 4: Changing the language to Slovak and regional settings to Slovak Republic.

sc_set_language('sk;sk_sk');

Languague Code
Language Value
Arabic ar
Bahasa Melayu ms
Belarusian be
Bengali bn
Bosnian bs
Bulgarian bg
Catalan ca
Chinese Simplified zh_cn
Chinese Traditional zh_hk
Croatian hr
Czech cz
Danish da
Dutch nl
English en_us
Estonian et
Finnish fi
French fr
Galician gl
German de
Greek el
Gujarati gu
Hebrew he
Hindi hi
Hungarian hu_hu
Indonesian id
Italian it
Japanese ja
Kannada kn
Korean ko
Latvian lv
Lithuanian lt
Macedonian mk
Marathi mr
Norwegian no
Polish pl
Portuguese Brazil pt_br
Portuguese Portugal pt_pt
Punjabi pa
Romanian ro
Russian ru
Serbian Cyrillic sr
Shuar jiv
Sinhalese si
Slovak sk
Slovenian sl
Spanish es
Swedish sv
Telugu te
Thai thai
Turkish tr
Ukrainian uk
Urdu ur
Regional settings code
Reginal Settings Value
Afrikaans (South Africa) af_za
Albanian (Albania) sq_al
Amharic (Ethiopia) am_et
Arabic (Algeria) ar_dz
Arabic (Bahrain) ar_bh
Arabic (Egypt) ar_eg
Arabic (Iraq) ar_iq
Arabic (Jordan) ar_jo
Arabic (Kuwait) ar_kw
Arabic (Lebanon) ar_lb
Arabic (Libya) ar_ly
Arabic (Morocco) ar_ma
Arabic (Oman) ar_om
Arabic (Qatar) ar_qa
Arabic (Saudi Arabia) ar_sa
Arabic (Syria) ar_sy
Arabic (Tunisia) ar_tn
Arabic (United Arab Emirates) ar_ae
Arabic (Yemen) ar_ye
Armenian (Armenia) hy_am
Azerbaijan (Azerbaijan) az_az
Bahasa Melayu (Malaysia) ms_my
Basque eu
Belarusian (Belarus) be_by
Bengali (Bangladesh) bn_bd