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.
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.
This macro saves the where clause content of the original application selected.
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
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
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");

This macro Interrupts the application execution if there are error messages generated by the macro "sc_error_message".

This macro generates an error message.
sc_exit (Option)
This macro forces the application to exit.
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 ({My_Field})
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 (Application, Parameter01; Parameter02; Target, Error, height_modal, width_modal)
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_sms ($arr_settings)
This macro is used to send text SMS messages
sc_send_whatsapp ($arr_settings)
This macro allows the dynamic sent of text messages through Whatsapp.
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.

This is a macro to refresh a Grid application

sc_block_display (Block_Name, on/off)
This macro dynamically show/hide the fields of a specific block.
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_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

This macro is used especially in Ajax events of a Grid application with the purpose of reloading the Grid data (refresh).

 

Ex:

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 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
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
 


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
 


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 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
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 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
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 Tree menu
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 Tree menu
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 Tree menu
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 Tree menu
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 Tree menu
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 Tree menu
onApplicationInit
onLoad
onApplicationInit
onLoad



sc_begin_trans("Connection")

Watch a tutorial



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 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
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);
}

 

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 Tree menu
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
onNavigate
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: 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
onNavigate
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 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
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_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_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 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
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 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
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 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
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 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
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 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
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 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
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 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
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 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
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 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
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 use of this macro results in the interruption of the application.
This way, any processing that will be executed after the use of the Marco or is being executed at the moment will be interrupted.
Here you can see an example of the macro's use.

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

This macro can be used in two ways: Without parameters sc_error_exit(); that just interrupts the application or informing one URL/application that the user will redirect when the error is shown.

Macro's parameter, All the parameters are optional.
Application/URL Optional Destiny application's name or URL to where will be redirected.
Target Optional

_blank, _self

 

When we inform one destiny application or URL and the Target parameter is not informed the _self will be used as default.

Available Targets
_blank Show the destiny application or URL in another window or tab. 
_self Show the destiny application or URL in the same window or tab.

 

Ex. 1: Show only an error message.

sc_error_message('Error message!');
sc_error_exit();


Ex. 2: Show an error message and an "OK" button to redirect to the URL informed.

sc_error_message('Error message');
sc_error_exit(http://www.mysite.com);

Ex. 3: Show an error message and an "OK" button to redirect to the application informed.

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 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
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);
}


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_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 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
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 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



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 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
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 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
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 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
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 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
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 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
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
-
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 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
onExecute
onLoad



sc_label({My_Field})

This macro aims to dynamically change the label of fields in a query or form application.

It has only one mandatory parameter that must receive the name of the field to be changed.

This parameter can receive a string with the name of the field or a variable.

 

Examples

Ex. 1: Using the field name directly in the macro.

sc_label("field_name") = "Cust Name";

 

Ex. 2: Using a local variable to define the field to be changed.

$var_fieldName = "field_name";
sc_label($var_fieldName) = "Cust Name";

 

Ex. 3: Using a global variable to define the field to be modified.

sc_label([global_variable]) = "Cust Name";

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 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
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 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 user name. (String or Variable that contains the user name)
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)ext or (H)tml.
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.

 

Ex. 1: Sending e-mail with reply_to parameter
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');

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

Ex. 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});

 

Ex. 3: No user and password.
sc_mail_send([glo_smtp], '', '', 'from.netmake.com.br', {to}, {subject}, {message}, 'H', '', '', '', '', [glo_att]);

The amount of emails sent will be stored at the special variable "sc_mail_count".

If any error happen 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".

 

Ex.4 :
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});
}


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_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 Tree menu
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 Tree menu
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 Tree menu
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 Tree menu
onExecute onApplicationInit
onExecute



sc_redir(Application, Parameter01; Parameter02; Target, Error, height_modal, width_modal)

This macro is used to redirect the processing application to other applications or a URL.


If the redirect uses parameters, these must be passed in the following format:
1) After the name of the application, use the comma delimiter (,) then
2) = (equal sign) .
3) More than one parameter must be separated by a semicolon (;)
4) The target determines which application is opened (default=_self): _self, _parent, _blank, or modal.
5) Optional parameter to set error messages redirection in the application: "F" redirects if there is an error in the application (default value) and "E" does not redirect.

 

OBS. If your connection uses transaction control the use of this macro on the events onAfterInsert, onafterupdate, onAfterDelete, onBeforeInsert, onbeforeupdate or onBeforeDelete should come after the use of macro sc_commit_trans so this way it will save the form changes.

This macro does not support the use of the Modal parameter when used in a Run button.



Ex. 1: Application without parameters nor target.
if ([global_user] == "test")
{
sc_redir(application_x);
}

Ex. 2: Application with parameters and without target.
if ([global_user] == "test")
{
sc_redir(application_x, parm1={var_test}; parm2="xxx");
}

Ex. 3: Application without parameters and with target.
if ([global_user] == "test")
{
sc_redir(application_x, "", "_parent");
}

Ex. 4: Application with parameter and target.
if ([global_user] == "test")
{
sc_redir(application_x, parm1={var_test}; parm2="xxx", "_blank");
}

Ex. 5: URL.
if ([global_user] == "test")
{
sc_redir(http://www.my_page.com);
}

�

OBS. Everything that was passed as parameters to the called application will be available as global variable.

EX: sc_redir(employee, parm1={var_test}; parm2="xxx", "_blank");

In the employee application the parameters will be accessible at [parm1] and [parm2]


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
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
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 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
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 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
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 Tree menu ReportPDF application
onExecute onApplicationInit
onCalendarApplicationInit
onCalendarScriptInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onValidate
onValidateSuccess
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 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
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 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
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 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
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 Tree menu
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 Tree menu
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 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
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 Tree menu
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 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
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_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_send_whatsapp($arr_settings)

This macro receives an array as a setting parameter that contains the API name set in the Scriptcase, the message, and the destiny number.

The parameters that will be used are:

  • profile: Here will be informed of the API name configured into the Scriptcase interface.
  • message: In this parameter is informed the message that will be sent through the macro.
  • to: Allows informing the destiny number of the message.

Exemplo de use:

$arr_settings = array(
                 'profile'  => 'ChatAPI',
                 'message'  => 'Test whatsapp',
                 'to' => '558182499699'
             );

sc_send_whatsapp($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 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
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 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
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
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 Tree menu ReportPDF application
onExecute onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onFilterInit
onFilterValidate
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onValidate
onValidateSuccess
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onScriptInit



sc_set_regional('String Regional')

This macro allows to dynamically change the application regional settings.

Ex. 1:
sc_set_regional('en_us');


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 Tree menu ReportPDF application
onExecute onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onFilterInit
onFilterValidate
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onValidate
onValidateSuccess
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onScriptInit



sc_set_theme('String Theme')

This macro allows to dynamically change the theme that will be used in the applications.

When used, the theme is changed in the session, causing all applications accessed later to receive the informed theme.

Parameter

This macro has only one parameter, which must be named after the theme that will be applied.
This parameter can be passed in two ways.

 

Example 1 - String with the name of the theme.
sc_set_theme ('BlueBerry');

Example 2 - Local variable receiving the value of a field or a global variable.
$ set_theme = {field_name};
sc_set_theme ($ set_theme);

 

Related Links
See how to dynamically change the theme of a project using the macro.

 

Macro Scope

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



sc_site_ssl

This macro is used to verify if the used site is a safe site. (https protocol)


Ex. 1: Using an affirmative.
if (sc_site_ssl)
{
echo "ok - Safe site";
}



Ex. 2: Using a negative.
if (!sc_site_ssl)
{
echo "Warning - Unsafe site";
}



Ex. 3: Redirecting if the site isn't safe.
if (!sc_site_ssl)
{
sc_redir("http://www.erro_page.com/") ;
}

Note: This macro works only on the web server llS.


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
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onScriptInit
onScriptInit onApplicationInit
onFilterInit
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onClick
onScriptInit
onLoadAll
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onLoad
onLoad onApplicationInit
onScriptInit



sc_sql_injection({My_Field}) or ($My_Variable)

This macro is used to protect the field/variable against "SQL injection" attempts.

Macro used for protection against "SQL injection" in commands generated by the developer when using the macros: sc_lookup, sc_select, or sc_exec_sql.


Ex. 1: Protecting a local variable:
$field_protect = sc_sql_injection({my_field});


Ex. 2: Protecting an user variable:
$field_protect = sc_sql_injection($my_var);

 

Note: that all database accesses, generated for the Scriptcase, have protection against "sql injection".


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
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
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onExecute
onLoad
onExecute
onLoad
onFooter
onHeader
onScriptInit
onRecord



sc_sql_protect(Value, "Type", "Connection")

This macro will protect the value passed as a parameter according to the user database, the "Connection" parameter is optional, if not informed Scriptcase will use the default connection.

The "Type" parameter so far can only use the "Date" value.

 

Ex 01: In this example we will protect the dates passed as parameter so this way it can be correctly interpreted to the ACCESSED database.

sc_select_where(add) = " AND news_noticias.noticia_data_pub
BETWEEN ".sc_sql_protect($data_inicial, "date")." AND ".sc_sql_protect($data_final, "date")."";

 
 

Macro Scope

Blank application calendar application Grid application Search application Form application Control Form ReportPDF application
onExecute onValidate onClick
onFooter
onGroupBy
onScriptInit
onNavigate
onRecord
onFilterValidate onAfterDeleteAll
onAfterInsertAll
onAfterUpdateAll
onBeforeDeleteAll
onBeforeInsertAll
onBeforeUpdateAll
onValidate
onLoadAll
onValidate
onRecord



sc_statistic (arr_val, tp_var)

This macro calculates and returns an array with the reported statistical values ​​from an array of numeric values.

Two parameters are required for using the macro.

Parameter Value Description
arr_val

This parameter accepts only variables.

Example of use:
$arr_val = array (5230.01,8374,625.45,8926.34,7000,523.78);
sc_statistic ($ arr_val, $ type);

Variable containing an array with the numeric input values.

Parameter required.

tp_var

This parameter accepts the value or a variable.

Example using value:
sc_statistic ($arr_val, 'P');

Example using a variable:
$type = 'P';
sc_statistic ($arr_val, $type);

List of values ​​accepted in the parameter.

  • P
  • A

This parameter defines the type of calculation of the variance(index 2) and standard deviation(index 3) of the array.

Accepted values ​​are P and A

  • P = Population
  • A = Sampling

Parameter required.

 

This macro returns the calculation in an array with 10 positions, where each position is related to a statistical data.

Check below what each index will return.

Values ​​returned in each index of the array:

Index Value
[0] Arithmetic mean
[1] Median
[2] Variance
[3] Standard deviation
[4] Amplitude
[5] Number of different values
[6] Number of array values
[7] Number of Null values
[8] Lowest value
[9] Highest value

Example of using the macro

$arr_val = array (5230.01.8374,625.45.8926.34,7000,523.78,523.78,6897.21,987.56,987.56,8729,63);

$arr_stat = sc_statistic ($arr_val, 'P');

 

Macro return:

Array
(
    [0] => 4072.3075
    [1] => 3108.785
    [2] => 12817792.489302
    [3] => 3580.1944764638
    [4] => 8863.34
    [5] => 10
    [6] => 12
    [7] => 12
    [8] => 63
    [9] => 8926.34
);

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_text_style({My_Field}, "Background-Color", "Size", "Color", "Family", "Weight")

This macro allows us to modify the text style of a grid field dynamically.

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

 

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


Macro Scope

Grid application
onRecord



sc_time_diff({datetime_01}, "Date_01 Format", {datetime_02}, "Date_02 Format")

 

sc_time_diff({datetime_01}, "Date_01 Format", {datetime_02}, "Date_02 Format");

This macro calculates the difference between hour, minutes, and seconds for two DateTime/time values.

The result will be returned in an array, with the dimensions [0], [1] and [2] containing hours, minutes, and seconds, respectively.

Parameter

Description

datetime_01

Value or variable for datetime_01

Date_01 Format

Value or variable to specify the format of datetime_01

datetime_02

Value or variable for datetime_02

Date_02 Format

Value or variable to specify the format of datetime_02

Ex. 1: General Format

{differences} = sc_time_diff({datetime_01}, "Date_01 Format", {datetime_02}, "Date_02 Format");

{diff_hours} = {differences[0]};
{diff_minutes} = {differences[1]};
{diff_seconds} = {differences[2]};

Ex. 2: Returning positive values

{differences} = sc_time_diff("2012-07-25 05:33:45", "yyyy-mm-dd hh:ii:ss", "2012-07-21 15:22:57", "yyyy-mm-dd hh:ii:ss");

{differences[0]} would be equal to 86 (hours);
{differences[1]} would be equal to 10 (minutes);
{differences[2]} would be equal to 48 (seconds);

Ex. 3: Returning negative values

{differences} = sc_time_diff("2012-07-21 15:22:57", "yyyy-mm-dd hh:ii:ss", "2012-07-25 05:33:45", "yyyy-mm-dd hh:ii:ss");

{differences[0]} would be equal to -86 (hours);
{differences[1]} would be equal to -10 (minutes);
{differences[2]} would be equal to -48 (seconds);

Ex. 4: Considering only the hours' format - Positive return

{differences} = sc_time_diff("18:14:55", "hh:ii:ss", "10:55:22", "hh:ii:ss");

{differences[0]} would be equal to 7 (hours);
{differences[1]} would be equal to 19 (minutes);
{differences[2]} would be equal to 33 (seconds);

Ex. 5: Considering only the hours' format - Negative return

{differences} = sc_time_diff ("10:55:22", "hh:ii:ss", "18:14:55", "hh:ii:ss");

{differences[0]} would be equal to -7 (hours);
{differences[1]} would be equal to -19 (minutes);
{differences[2]} would be equal to -33 (seconds);

 

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
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
onLoad onApplicationInit
onFooter
onHeader
onScriptInit
onRecord



sc_trunc_num({My_Field}, Decimal_Number)

This macro is used to truncate numerical values that exceed the decimals amount specified.

 

Parameter
Descri?003f006f
My_Field Variable with value to format (return in the same variable).
Decimal_Number Amount of decimals to display.

 




Ex. 1:
sc_trunc_num({my_value}, 2);

Input value = 1250.235
Output value = 1250.23

Input value = 1250.2
Output value = 1250.20

Input value = 1250
Output value = 1250.00


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
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
onExecute
onLoad
onApplicationInit
onFooter
onHeader
onScriptInit
onRecord



sc_url_exit(URL)

This macro modifies the application exit URL.


Ex. 1:

sc_url_exit(http://www.scriptcase.net);



Ex. 2:

sc_url_exit(aplx.php);


Macro Scope

calendar application chart application Grid application Search application Form application Control Form ReportPDF application
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onScriptInit
onScriptInit onApplicationInit
onFilterInit
onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onApplicationInit
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onClick
onScriptInit
onLoad
onNavigate
onLoadRecord
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onClick
onScriptInit
onLoadAll
onValidate
onValidateFailure
onValidateSuccess
onRecord



sc_url_library("Target", "Library Name", "File")

This macro will return the file path, inside a library, to be used on the Scriptcase applications. It is necessary to have a library created on Scriptcase to use this Macro. To create a library, go to the "Tools > Library" Menu.

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 Given name to the library at the time of creation.
File The absolute path within the library.

 

 

Ex. 1 - Importing CSS files from a library:
<*link rel="stylesheet" type="text/css" href="<*?php echo sc_url_library('prj', 'bootstrap-3.3.2-dist', 'css/style1.css'); ?>" />

 

Ex. 2 - Importing a JS file from a library:
<*script type="text/javascript" src="<*?php echo sc_url_library('prj', 'bootstrap-3.3.2-dist', 'js/bootstrap,js'); ?>">

NOTE: Note that you need to remove the asterisk (*) form the examples above to use it.


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application Tree menu
onExecute ajaxFieldonBlur
Onchange
OnClick
OnFocus
onAfterDelete
onAfterInsert
onAfterUpdate
onApplicationInit
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onCalendarApplicationInit
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
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
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onBlur
onChange
onClick
onFocus
onApplicationInit
onClick
onScriptInit
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onExecute
onLoad



sc_user_logout('variable_name', 'variable_content', 'apl_redir.php', 'target')

This macro is used to log the user out to the system.

If the target is not informed, the default value is "_top".

 

Ex:

sc_user_logout('usr_login', 'admin', 'ctrl_login.php', '_self');


Macro Scope

Blank application calendar application chart application Grid application Form application Control Form ReportPDF application
onExecute onAfterDelete
onAfterInsert
onAfterUpdate
onBeforeDelete
onBeforeInsert
onBeforeUpdate
onScriptInit
onLoad
onValidate
onValidateSuccess
onHeader
onScriptInit
onScriptInit onAfterDelete
onAfterDeleteAll
onAfterInsert
onAfterInsertAll
onAfterUpdate
onAfterUpdateAll
onBeforeDelete
onBeforeDeleteAll
onBeforeInsert
onBeforeInsertAll
onBeforeUpdate
onBeforeUpdateAll
onScriptInit
onLoad
onNavigate
onLoadRecord
onValidate
onValidateSuccess
onScriptInit
onLoadAll
onValidate
onValidateSuccess
onHeader
onScriptInit
onRecord



sc_warning'on' or 'off'

This macro dynamically activates or deactivates warning messages control.

Warning messages are generated when a reference is made to an non-existent variable, an item of an non-existent array, etc.

 

Ex. 1: To deactivate the message (do not display).
sc_warning = 'off';

 


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
onScriptInit
onLoad
onRefresh
onValidate
onValidateFailure
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
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_webservice("Method", "URL", "Port", "Send Method", "Parameters Array", "Setting's Array", "Timeout", "Return")

This macro is used to communicate with a web service.

Parameter
Description
Method Informs what method will be used to access the web service. Ex: file_get_contents or curl.
URL URL used to access the web service.
Port Port used to access the web service.
Send Method Defines the request method of the web service. It can be GET ou POST.
Parameters Array Parameter's array used to access the web service, varying according to the accessed service.
Settings's Array(optional) Parameter's array for configuration of the access method used.
Timeout(optional) Service's access timeout.
Return(optional) Web service's return method. When it is set as "True", the return from the web service comes as an array, if it is set as "False" it will return as the original web service format. Default: True

 

 

$parms = array(
'METHOD' => 'GetBalance',
'RETURNALLCURRENCIES' => 1,
'VERSION' => urlencode(51.0),
'USER' => urlencode({paypal_api_login}),
'PWD' => urlencode({paypal_api_password}),
'SIGNATURE' => urlencode({paypal_api_key})
);
$parms = http_build_query($parms);

Ex1 - Using the macro file_get_contents:
sc_webservice('file_get_contents', $webservice_url, $_SERVER["SERVER_PORT"], "POST", $parms, array(), 30);

 

Ex2 - Using the macro with CURL:
$response = sc_webservice("curl", {paypal_type}, 80, "POST", $parms, array(CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER=>false), 30);


Macro Scope

Blank application calendar application chart application Grid application Search application Form application Control Form Menu application 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 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
onExecute
onLoad



sc_where_current

Variable to reference the application where clause plus the filter selections (if any). Reflects the where clause currently used.

 

Ex. 1:
$save_current_where = {sc_where_current};


Macro Scope

chart application Grid application ReportPDF application
onFooter
onHeader
onScriptInit
onClick
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onFooter
onHeader
onScriptInit
onRecord



sc_where_filter

This macro is used to retrieve the content generated by the "filter", according to its selections. These are the data that will be added to the application original where clause after filter submission.

 

Ex. 1:
$save_current_filter = {sc_where_filter};

 


Macro Scope

chart application Grid application ReportPDF application
onFooter
onHeader
onScriptInit
onClick
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onFooter
onHeader
onScriptInit
onRecord



sc_where_orig

This macro saves the application's original where clause. It can be used inside ScriptCase events, to manipulate the data, or to display it anywhere in the grid.

Ex. 1:
$save_where = {sc_where_orig};


Macro Scope

chart application Grid application Search application ReportPDF application
onFooter
onHeader
onScriptInit
onClick
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onApplicationInit
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
onFooter
onHeader
onScriptInit
onRecord



sc_zip_file("File", "Zip")

This macro is used to generate ZIP files from a list of files and/or directories. The file parameter must be one of the following:

- Filename
- Directory name
- A variable containing an array, which contains files and/or directories list.
- A variable a file or a directory name.
- A variable containing an array, which contains files and/or directories list.

The zip parameter must contain the name of the zip file generated or the path to the file.


Ex. 1: Single file compressing.
sc_zip_file("/test/sample.htm", "/tmp/test.zip");


Ex. 2:
Single directory compressing.
sc_zip_file("/test", "/tmp/test.zip");


Ex. 3:
Multiple files and directories in an array.
$prep = array();
$prep[] = "/test/sample.htm";
$prep[] = "/test";
sc_zip_file($prep, "/tmp/test.zip");