Open topic with navigation

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 transations in the database.
sc_change_connection ("Old_Connection", "New_Connection")
This macro dynamically change the application connections.
sc_commit_trans ("Connection")
This macro effective a set of transations in the database.

With this macro you can concat fields on select for every database.

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

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 modify dynamically the grids "ORDER BY" clause field.
This macro adds dynamically 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 it used protect the field/variable against "SQL injection".
sc_sql_protect (Value, "Type", "Connection")
This macro protects the value passed as parameter according with the used database.
This macro its used to make a reference of the where clause currently used.
This macro saves the where clause content of the original application select.
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 retuning 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")
This macro shows a Javascript alert message screen.
sc_apl_conf ("Application", "Property", "Value")
This macro modify the application execution property.
sc_calc_dv (Digit, Rest, Value, Module, Weights, Type)
This macro calculate verify digits.
sc_changed ({Field_Name})
This macro returns "true" if the field name have been changed.
sc_confirm ("Message")
This macro shows a Javascript confirm 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, "Target") or (My_Application, "Target")

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

This macro generate an error message.
sc_exit (Option)
This macro forces the application exit.
sc_getfield ('myField')
This macro assign the properties of a field to a javascript variable.
This macro returns the abbreviation of the language used.
This macro returns the abbreviation of the regional settings used.
This macro returns the application theme name.
sc_groupby_label ("My_Field")
This macro dynamically modify the field label displayed in groupby lines.
sc_image (Image01.jpg)
This macro loads images passed as parameter to use in the application.
sc_include ("File", "Source")
This macro its used to "include" PHP routines.
sc_include_lib ("Lib1", "Lib2", ...)
This macro its used to select dynamically 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 language and regional settings.
sc_log_add ("action", "description")
This macro will add a register 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 its 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 its used to redirects to other application or URL.
sc_reset_global ([Global_Variable1], [Global_Variable2] ...)
This macro delete session variables received as parameter.
This macro provide the register sequential number.
sc_set_global ($variable_01) or ({My_Field})

This macro its used to register session variables.

Macro is used to select an specific GROUP BY rule.

sc_set_language ('String Language')
This macro allows 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 its used to dinamically define the application themes.
This macro verifies if its been used a safe/secure site. (https protocol)
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 its 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 establish the connection with the user credentials.

Macro 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")
This macro allows the application to display customized messages.

Macro to refresh a Grid

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 its 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 dynamically display or not a specific field.
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 set a form field attribute to '"Read-Only"
sc_field_style ({My_Field}, "Background-Color", "Size", "Color", "Family", "Weight")
This macro allolws to modify dinamically the grid field style.
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 not the form.

This macro provides the name of the groupby rule running at the time.

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 form 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_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.
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_pdf_name "sc_my_file_name.pdf"
This macro will change the grid's exported files name.
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 dinamically an item to the menu.
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 removes dynamically 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')

Macro 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 deactivate menu structure items.

Macro 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 events in form/control applications.

This macro receive two parameters: a required one which recive a the JS method name and an optional that recive an array with the method parameters on it.

This macro is only valid in applications with AJAX support.

Examples:

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


Ex. 2: Method javascript with a paramenter:
sc_ajax_javascript('JavascriptMethodName', array("paramameter"));


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


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

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

This macro is only available in applications with AJAX support.

ParametersDescription
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

Table2: Message Parameters String

PropertyDescriptionValuesExample
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

Ex. 01

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


Macro Scope

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



sc_ajax_refresh()

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

 

Ex:

sc_ajax_refresh();


Macro Scope

Grid application
onClick



sc_alert("Message")

This macro shows a Javascript alert message box.

Ex. 1:
sc_alert("This is an alert message!!");


Macro Scope

Control Form
onLoadAll
onValidate



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

This macro allows to modify the property of the application. The user can determine if a Form will start in insert mode, or a Grid starts by 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 addtion 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 Dinamically hides a field.
field_display_on field Dinamically shows a field.
field_readonly field Dinamically set the "readonly" attribute in order to select the field.
rows Forces the number of lines for each page (only for form of multiple records).
rows_ins Forces the number of lines for insert (only for 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_status("Application", "Status")

Used to control the security access. These macros activate/deactivate the applications that a user has acess 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
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 dinamically an item to a menu application.

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.
Aplication 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 initializes the array used in the dimanically creation of the menu application. It must be informed the menu application name as parameter.

This macro must be used in control events or onload menu event.


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

Verify if a menu item exists and returns true or false.

Parameter Description
menu_name Menu application name
id_item Menu item id

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

Remove dinamically a menu item.

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

Parâmetro Descrição
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 dinamically

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.
Aplication Menu item URL or application name
Parameters String with parameter to pass to the application menu item
Ex.: param1=valor;param2=valor
Icon Icone path used in menu item.
Hint Descriptive Hint for menu item.
Target 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")

This macro starts a set of transactions in the database.

In form applications, the events that can run this macro is dependent of the database update (onAfterInsert, onAfterUpdate, onAfterDelete, onBeforeInsert, onBeforeUpdate or onBeforeDelete), they are automatically protected through transaction control, since the connection is the same of the application.

In the other cases, if the user wish to make 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 database from the specified 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 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. Can be tested and used inside the ScriptCase events, allowing especific programmation 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. Can be tested and used inside the ScriptCase events, allowing especific programmation 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 macros 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_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/deactivate.

Buttons Name (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 detail PDF.
pdfbw Generates black and white PDF.
xls Generates the XLS.
xml Generates the XML.
cvs Generates the CVS.
rtf Generates the RTF.
word Generates the Word.
print Displays the "Print" button in the grid.
det_print Displays the "Print" Button in the detail.
summary Displays the "Summary" button in the grid.
new Displays the "New" button. (if the application has 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.
groupby Displays the "Group By" button in the grid.
dynsearch Displays the "Dynamic Search" button in the grid.
gridsave Displays the "Save Grid" button in the grid.

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 its 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 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 a control.
exit Displays the "Exit" button on a control.
facebook Displays the "Facebook" button on a control.
twitter Displays the "Twitter" button on a control.
google Displays the "Google+" button on a control.
paypal Displays the "PayPal" button on a control.

OBS. Remember that the buttons 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. Can be tested and used inside the ScriptCase events, allowing especific 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_new

Available when the "Add New" button is clicked. Can be tested and used inside the ScriptCase events, allowing especific programmation 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. Can be tested and used inside the ScriptCase events, allowing especific programmation 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 recieve the calculated digit.
Rest Variable that will recieve the "rest" of the division.
Value Value or Variable to calculate the digit.
Module Value or Variable containing the module to be used. Default value is module "11".
Weights Value or Variable containing the weights to be used. Default value is the "98765432" values.
Type Value or Variable containing the parcels calculation to be used: 1 to normal sum of the parcels values and 2 to the sum of each algorithm of the parcels. 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_changed({Field_Name})

Macro to check if the field name have been changed.

Ex. 1:
if (sc_changed({my_field}))
{
Echo "Filed 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_Connection", "New_Connection";
"Old_Connection02", "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 ";" (semicolon).

Ex. 2: To use variables or change the main connection as follows:
sc_change_connection ([Global_Connetion], [Test_Connection]);


Ex. 3: To delete the exchange:
sc_reset_change_connection ();

The exchanges take effect in the following applications


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 has the objective to confirm a transaction set in the database.

In form applications, the events that can run this macro is dependent of the database update (onAfterInsert, onAfterUpdate, onAfterDelete, onBeforeInsert, onBeforeUpdate or onBeforeDelete), they are automatically protected through transaction control, since the connection is the same of the application.

If the user, in any of these events, use an application redirectioning (macro "sc_redir") must before the redirect, use this macro to guarantee the transactions previously effected.

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

With this macro you can concat fields on select for every database.

Example(Edition Lookup):

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

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

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

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

Ex. 1:
sc_confirm ("Do you really wish to execute this action??");


Macro Scope

Form application Control Form
onClick onClick



sc_connection_edit("Connetion_Name", $arr_conn)

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
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 cease to exist when the session is closed.

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
Descrição
access MS Access
ado_access MS Access ADO
odbc Generic ODBC
db2 DB2
db2_odbc DB2 Native ODBC
odbc_db2 DB2 Generic ODBC
odbc_db2v6 DB2 Generic ODBC 6 or Lower
firebird Firebird
borland_ibase Interbase 6.5 or Higher
ibase Interbase
pdo_informix Informix PDO
informix Informix
informix72 Informix 7.2 or Lower
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_mysql MySQL PDO
mysqlt Mysql (Transactional)
mysql MySQL (Non-Transactional)
oci805 Oracle 8.0.5 or Higher
odbc_oracle Oracle ODBC
oci8 Oracle 8
oci8po Oracle 8 Portable
oracle Oracle 7 or Lower
postgres7 PostgreSQL 7 or Higher
pdo_pgsql PostgreSQL PDO
postgres64 PostgreSQL 6.4 or Higher
postgres PostgreSQL 6.3 or Lower
pdosqlite SQLite PDO
sqlite SQLite
sybase Sybase

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
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 parameter with an input format to another field with an output format.

Parameter
Description
A or Y Used to reference years.
M Used to reference Months.
D Used to reference Days.
Db_Format Used to get the Dadabase date format.

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.
{field_date} = sc_date_conv({field_date}, "dd/mm/aaaa", "db_format");


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 amount of days, months and years.


The result is returned in an array structure, where the index 0 have the amount of days, the index 1 have the amount of months and the index 2 have the amount 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:
{differences} =
sc_date_dif_2 ({date1}, "yyyy-mm-dd", {date2}, "mm/dd/yyyy", 1);
{dif_days} = {differences[0]};
{dif_months} = {differences[1]};
{dif_years} = {differences[2]};

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


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


Note: Formats between the two dates can be different but it must have 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_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})

Returns, the encrypted field or variable, to its original value.

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



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


Note: 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_cript = sc_encode({my_field});



Ex. 2: Encrypting an user variable:
$field_cript = 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_erro_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, "Target") or (My_Application, "Target")

Interrupts the application execution, if there is error message generated through "sc_error_message" macro, displaying the error messages. If informed an URL or the name of an Application, an "OK" button is displayed, bellow the error messages to redirect the processing to the informed URL/Application.

The target parameter is opitional.


Ex. 1: Displays only the error messages.
sc_error_exit();


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

sc_error_exit(http://www.mysite.com);


Ex. 3: Display the error messages and the "OK" button to redirect to Application, opening in another window.

sc_error_exit(my_application, "_blank");


Macro Scope

calendar application Search application Form application Control Form
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
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 neede to treat these messages. For example, in case of database validations via triggers or procedures that return message.

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

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

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 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 delimiter for the macro interpreter.


Macro Scope

calendar application Search application Form application Control Form
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
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 treat these messages. For example, in case of database validations via triggers or procedures that return message.


Ex. 1: Variable {sc_erro_update}, returning an error message generate by a database trigger using mssql.

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

Note: To have access 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 data base 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
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 button and may return values/process 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 adn 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) Doesn't display the window with an OK button refresh data and returns to the current application.
sc_exit(ok,ref) Same of the sc_exit(ref) function; however, display the OK button.
sc_exit(ok,sel) Same of 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 macros its 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 its used to block a field to get any data that would be typed on it.

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

The parameter its optional, "I" its 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 addtion and update.
sc_field_disabled("Field_02=false");

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

Ex. 4: Combination of block and unblock of several fields, for adition 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 determined fields in the lines of the Multiple Record form, Editable Grid and Editable Grid View.

Fields that are suppose 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("Filed_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 dynamically display a specific field.
By default all the fields are display ("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 ReportPDF application
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
onScriptInit



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 set 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 opitional, used by an ajax event to define if a field its 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 modify the grid field style dinamically.

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


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 formated (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 exisiting decimals (Y = yes and N = no).
Monetary_Sym Display monetary symbol (Y = yes and N = no).

Ex. 1: Formating 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 not a form.
By default, the form is displayed ("on" condition).

Ex. 1: Doesn't 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 groupby 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

chart application Grid application
onFooter
onHeader
onScriptInit
onScriptInit
onNavigate
onRecord



sc_get_language

This macro returns the abbreviation of the language used.

Ex. 1:

$my_language = sc_get_language();


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

Ex. 1:

$my_regional = sc_get_regional();


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_groupby_label("My_Field")

This Macro dynamically modify the field label displayed in 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_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.

 

Ex:

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

sc_hide_groupby_rule('rule_1', 'rule_2');

}


Macro Scope

chart application Grid application
onApplicationInit onScriptInit



sc_image(Image01.jpg)

This macro its 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 catalogue his PHP scripts to use in various applications.

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

When a script is catalogued, 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 acess.
- Project: Only the project users (the one's that will be loged at that time) will have acess.
- User: Only the user (the one's that will be loged at that time) will have acess.


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 its used to select dynamically the application libraries.

PHP Libraries
JavaScript Libraries
tcpdf Jquery
fpdf_html jquery_thickbox
excel jquery_blockui
rtf tiny_mce
-
jquery_touch_punch

Ex. 1:

sc_include_lib ("tcpdf");

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


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. Can be "sys" for libraries of Public scope or "prj" for libraries of Project scope.
Library Name Name given to the library at the time of creation.
File 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 its used to modify dynamically the grid form field label.



Ex. 1: Using the field name.
sc_label("Customer") = "Cust Name";



Ex. 2: Using a variable as paramenter.

sc_label({Customer}) = "Cust Name";



Ex. 3: Using a global variable.
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};


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
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 successfull 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() )

Macro 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 aobut 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)

This macro dynamically creates or modifies links between grid applications and other applications.

Column: Grid column field name to generate the link.
Application: Application name to establish the link.
Parameters: Parameters required by the called application.

Must be informed "=" (attribution sign) . More than one parameter must be separated by ";" (semicolon).

Hint: Observation or tip displayed when the mouse cursor passes over the link.

Target : Where the application will function call and may be:

Target
Descrição
"_self" For carrying on the same page (overrides the query);
"_blank" To run on another page (pop-up);
"iframeT" To run in an iframe above the Grid (top);
"iframeL" To run in an iframe, the left of the Grid (Left);
"iframeR" To run in an iframe, the left of the Grid (Left);
"iframeB" To run in an iframe below the Grid (Bot);
"modal" Opens a new window and blocks any interaction in the main window;

In the case of modal target, there are two optional parameters *:

*Height: Set the height of the modal window (default 440);
*Width: Set the width of the modal window (default 630);

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

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 an URL: in this case, "paramater and target" have no effect. It will be executed redirecting to a informed URL.
sc_link (my_field, http://www.scriptcase.com, ,"hint of the link");


Macro Scope

Grid application ReportPDF application
onRecord 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.


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_erro" variable. It is also important to verify the select returned data, to prevent access to inexistent 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_erro} ;
}
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 clienteid = '{customer_id} ' and salesman_id = [var_glo_salesman]");

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

Note2: For a big result returned in the dataset we recomend the use of the macro sc_selec 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
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 its 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 recieve the message, it could be a string or variable that cointains 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 recieve the message, it could be a string or variable that cointains one or more emails separated by ";" or one variable that contains one array of emails.
Copies_Type Type copies: BCC (Hiden 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';

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

Ex. 1:
sc_mail_send('smtp.meuserver.com.br', 'usr', 'pw', 'from@netmake.com.br'
, 'to@netmake.com.br', 'Test Email Subject', 'Message', 'H', 'abc@cop.com.br;zxy@cop.com.br', 'H', '', '', 'c:/test/arq.txt');


Ex. 2: Usising 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}, {sunject}, {message}, 'H', '', '', '', '', [glo_att]);

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

If any error happend when the scriptcase try to send the email, the variable "sc_mail_ok" will recieve "false" and the error message will be stored on the variavle "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 sucess!!";
}
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 application (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 a 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 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. Can be use in menu applications or tree menu.

Observe that the parameters used in this macro are the "ID" of the items.

If a menu item its removed and it have "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 pass 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 variable is only avaliable for menu application and it has the objective of giving acess to a menu item that was selected, this way the user can take desicions before to run 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 its used to redirect the processing to other application or URL.


If the redir 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 semicolon (;)
4) The target determine 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 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.



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

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. Everthing that was passed as parameter to the called application will be avaliable as global variable.

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

In the employee.php application the parameters will be acessible 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
onScriptInit
onLoad
onValidate
onValidateSuccess
onApplicationInit
onScriptInit
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 have the objective to delete all modifications effected by the sc_apl_conf macro.
The property parameter its opicional, if its 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
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onFilterInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onValidate
onValidateSuccess
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
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
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
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".

Esta macro desfaz as edições de conexão feitas pela 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
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
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 has the objective 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
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 have 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")

This macro its 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 dacisions 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.


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
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 grip 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 evento "onInit";


Macro Scope

chart application Grid application
onScriptInit onScriptInit



sc_select_order("Field")

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

Is possible, during grid execution time to add a field/condition to the search WHERE clause.

Ex. 1: It adds the contente 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_seq_register

This macro provide 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_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 its used to set the focus to a form field.

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 its 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: For 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
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 GROUPBY rule in execution time in the onApplicationInit event.

 

Ex:

sc_set_groupby_rule = "rule id";


Macro Scope

chart application Grid application
onApplicationInit onApplicationInit



sc_set_language('String Language')

This macro allows to define the application language dinamically.

Ex. 1: Changes the laguage to English.
sc_set_language('en_us');



Ex. 2: Changes the laguage 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 Eslovak and regional settings to Slovak Republic.

sc_set_language('sk;sk_sk');


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_pdf_name"sc_my_file_name.pdf"

The resulting files of the exported data (PDF, XLS, XML, CSV, WORD and RTF) are stored in "temporary" directory specified in the Scriptcase's configuration in development and in production, with the prefix "sc_" followed by a unique identification so the file of a user does not overwrite to one another.

The prefix "sc_" makes Scriptcase delete the old files. To assign different names Scriptcase patterns, can use the following macros:

- sc_set_csv_name

- sc_set_pdf_name

- sc_set_rtf_name

- sc_set_xml_name

- sc_set_xls_name

- sc_set_word_name

Ex1:

sc_set_xls_name = "my_file.xls";

Ex2: sc_set_csv_name = "sc_my_new_file.csv";

NOTE:

1) These macros should be used in the event "onApplicationInit."

2) Even using the macro, remained the prefix "sc_" (as Ex2), the Scriptcase will delete the file when it reaches the configured timeout limit (see the setting "File Lifetime" in the production environment).


Macro Scope

chart application Grid application
onApplicationInit onApplicationInit



sc_set_regional('String Regional')

This macros allows to dynamically change the application regional settings.

Ex. 1:
sc_set_regional('en_us');


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 macros allows to define the application theme dinamically.

Ex. 1:

sc_set_theme('Newyellow');



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 its used to verifie if a 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 to 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 its used to protect the field/variable against "sql injection".

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 paramenter according with the used database, the "Connection" parameter is opicional, 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 ACCESS 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_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.
Parâmeter
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 which exceed the decimals amount specified.

Parâmetro
Descrição
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 in the "Tools > Library" Menu.

Paramenter
Description
Target Tells you what the scope of the library. Can be "sys" for libraries of Public scope or "prj" for libraries of Project scope.
Library Name Given name to the library at the time of creation.
File 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
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 inexistent variable, an item of an inexistent 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. 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 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 with its selections. These are the data which will be added to the application original where clause after filter submition.


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 original where clause. 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 ReportPDF application
onFooter
onHeader
onScriptInit
onClick
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
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:

- File name
- Directory name
- A variable containing array, which contains a files and/or directories list.
- A variable a file or a directory name.
- A variable containing array, which contains a 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");



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
onFooter
onHeader
onScriptInit
onScriptInit onApplicationInit
onFilterInit
onFilterSave
onFilterValidate
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
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onFooter
onHeader
onScriptInit
onRecord



Authentication Variables

These variables must be defined on applications with PDF export on environments with integrated authentication.

Variables
Description
[sc_pdf_usr] Authentication User.
[sc_pdf_pw] Authentication Password


Ex. 1:On a login application, it is possible to set these variables from the info given by the user:

[sc_pdf_usr] = {login_usr};
[sc_pdf_pw] = {senha_usr};



Macro Scope

Grid application Form application
onApplicationInit
onFooter
onGroupBy
onScriptInit
onScriptInit



Database Variables

Global variables containing database access values used by main connection.

Variables
Description
sc_glo_server Server name.
sc_glo_db Database name.
sc_glo_db_type Database type (mssql, oracle, mysql, etc).
sc_glo_user Connected user name.
sc_glo_pass Database password access.
sc_glo_cript_pass Encrypted password (S/N).
sc_glo_decimal_db Used decimal separator (point or comma).



Ex. 1:

$my_database = [sc_glo_db];



These variables only reference the values without updating it (it is not possible to attribute/modify the values). To define user and the password to connect to the database, use the following variables:

Variables
Description
sc_db_master_usr User login to be used.
sc_db_master_pass Password to be used.
sc_db_master_cript Encrypted password (S/N) (see sc_encode macro).

Important: These variables only take effect during next application execution remaining valid during all the session (unless modified).


Ex. 2:
An application type "control" with a form created with information "login" and encrypted "password". These data must be used to connect to the database, during the system applications execution.
$temp_pass = sc_encode({password});
[sc_db_master_usr] = {login};
[sc_db_master_pass] = $temp_pass;
[sc_db_master_cript] = "S";


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
onFooter
onHeader
onScriptInit
onFooter
onGroupBy
onHeader
onScriptInit
onNavigate
onRecord
onFilterInit
onFilterRefresh
onFilterSave
onFilterValidate
ajaxFieldonBlur
Onchange
OnClick
OnFocus
onBlur
onChange
onClick
onLoadAll
onRefresh
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onExecute
onLoad
onFooter
onHeader
onScriptInit
onRecord



Totalling Variables

During group by and summary processing, Scriptcase generates total variables to each group level.

The routines are defined in event “onGroupBy” determining the break levels and avalilable to each record. Totals special variables are then referenced substituting the group name for the key word “groupby”, as in:

Variables
Description
{count_ger} Records total amount.
{sum_parcel} Will show the total sum for the field "Parcel"
{sum_balance} Will show the total sum for the field "Balance"
{count_groupby} Current Group records total.
{sum_groupby_parcel} Current Group level sum for the field “Parcel”.
{sum_groupby_balance} Current Group level sum for the field “Balance”.

Ex. 1: In an application with a group by state and city that totalizes a balance field, in the group totals, is possible to display the average (avg) instead of the balance as follows.

{sum_groupby_balance} = {sum_groupby_balance} / {count_groupby};


Macro Scope

chart application Grid application ReportPDF application
onFooter
onHeader
onFooter
onGroupBy
onRecord
onFooter
onHeader
onRecord



Totalling Variables (group by)

During the group by processing, Scriptcase generates total variables to each group level. The routines are defined in event “onGroupBy” determining the group levels. Totals special variables are then referenced substituting the group name for the key word “quebra”, as in:

Variable
Description
{count_ger} Records total amount.
{sum_parcel} Field “parcels” total.
{sum_balance} Field “Balance” total.
{count_quebra} Current group level records total.
{sum_quebra_parcel} Current group level field “parcels” total.
{sum_quebra_balance} Current group level field “Balance” total.



Ex. 1: In an application with a group by state and city and that totalizes a balance field, in the group totals, is possible to display the average (avg) instead of the balance as follows.
{sum_quebra_balance} = {sum_quebra_balance} / {count_quebra};


Macro Scope

Grid application
onFooter
onGroupBy