Scriptcase Macros

April 3, 2018 | Author: Willmington Espino Arauz | Category: Microsoft Sql Server, Databases, Areas Of Computer Science, Software Engineering, Technology


Comments



Description

ScriptCase MacrosPágina 1 de 54 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 Shows sc_ajax_message ("Message", "Title", "Parameters", "Parameters_Redir") sc_block_display (Block_Name, on/off) sc_field_color ("Field", "Color") sc_field_disabled ("Field_Name = True/False", "Parameter") sc_field_display ({My_Field}, on/off) sc_field_init_off (Field1, Field2,...) sc_field_readonly ({Field}, on/off) sc_field_style ({My_Field}, "Background-Color", "Size", "Color", "Family", "Weight") sc_format_num ({My_Field}, "Group_Symb", "Dec_Symb", "Amount_Dec", "Fill_Zeros", "Side_Neg", "Currency_Symb", "Side_Currency_Symb") sc_form_show 'on' or 'off' sc_set_focus ('Field') This macro allows the application to display customized messages. This macro dynamically show/hide the fields of a specific block. This macro changes the color of a determined field text. This macro its used to block a field to get any data that would be typed on it. This macro dynamically display or not a specific field. This macro is intended to inhibit the query fields on the initial load. This macro dynamically set a form field attribute to '"Read-Only" This macro allolws to modify dinamically the grid field style. This macro its used to format numerical values. This macro dynamically show or not the form. This macro its used to set the focus to a form field. Security sc_apl_status ("Application", "Status") sc_reset_apl_conf ("Application", "Property") sc_reset_apl_status sc_reset_menu_delete sc_reset_menu_disable This macro Activate/Deactivate the applications at user level. 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"). Filter sc_where_filter This macro its used to save the where clause content generated through the filter form. Barcode sc_lin_cod_barra_arrecadacao sc_lin_cod_barra_banco sc_lin_digitavel_arrecadacao sc_lin_digitavel_banco file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/... 28/09/2012 ScriptCase Macros Página 2 de 54 SQL sc_begin_trans ("Connection") sc_change_connection ("Old_Connection", "New_Connection") sc_commit_trans ("Connection") sc_error_continue ("Event") sc_error_delete sc_error_insert sc_error_update sc_exec_sql ("SQL Command", "Connection") sc_lookup (Dataset, "SQL Command", "Connection") sc_reset_change_connection sc_rollback_trans ("Connection") sc_select (dataset, "SQL Command", "Connection") sc_select_field ({Field}) sc_select_order ("Field") sc_select_where (add) sc_sql_injection ({My_Field}) or ($My_Variable) sc_sql_protect (Value, "Type", "Connection") sc_where_current sc_where_orig variáveis database Database Variables This macro starts a set of transations in the database. This macro dynamically change the application connections. This macro effective a set of transations in the database. 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. This macro execute SQL commands passed as parameter or a SQL command in the SQL field action type. 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 discards a set of transations in the data base. This macro executes the commands passed in the second parameter and returns the dataset in a variable. This macro modify dynamically a field that will be recovered in the grid. This macro modify dynamically the grids "ORDER BY" clause field. This macro adds dynamically a condition to the grid WHERE clause. This macro it used protect the field/variable against "SQL injection". 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. Global variables containing database access values used by main connection. Date sc_date (Date, "Format", "Operator", D, M, Y) sc_date_conv ({Field_Date}, "Input_Format", "Output_Format") sc_date_dif ({Date1}, "Format Date1", {Date2}, "Format Date2") sc_date_dif_2 ({Date1}, "Format Date1", {Date2}, "Format Date2", Option) sc_date_empty ({Field_Date}) This macro calculates and returns increments and decrements using dates. This macro converts the date field passed as parameter with an input format to another field with an output format. This macro calculates the difference between two dates (passed as parameters) returning the result in days. This macro calculates the difference between two dates returning the amount of days, months and years. This macro checks if a date field its empty retuning a boolean. Control sc_add_line_tit (Title1, Colspan, Align, Background Color, Font Size, Font Color, Font Type); sc_ajax_javascript ( 'JavascriptMethodName', array This macro add lines on the top of the Grid title, before it starts. This macro allows the execution of JavaScript methods in form/control file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/... 28/09/2012 ScriptCase Macros Página 3 de 54 ("parameter")) sc_alert ("Message") sc_apl_conf ("Application", "Property", "Value") sc_calc_dv (Digit, Rest, Value, Module, Weights, Type) sc_changed ({Field_Name}) sc_confirm ("Message") sc_decode ({My_Field}) sc_encode ({My_Field}) sc_error_exit (URL, "Target") or (My_Application, "Target") sc_error_message ("Text") sc_exit (Option) sc_getfield ('myField') sc_get_language sc_get_regional sc_get_theme sc_groupby_label ("My_Field") sc_image (Image01.jpg) sc_include ("File", "Source") sc_include_lib ("Lib1", "Lib2", ...) sc_label ({My_Field}) sc_language sc_link (Column, Application, Parameters, "Hint", "Target", Height, Width) sc_log_add ("action", "description") sc_log_split ({description}) sc_mail_send (SMTP, Usr, Pw, From, To, Subject, Message, Mens_Type, Copies, Copies_Type, Port, Connection_Type, Attachment) sc_make_link (Application, Parameters) sc_master_value ('Object', Value) sc_redir (Application, Parameter01; Parameter02; Target, Error) sc_reset_global ([Global_Variable1], [Global_Variable2] ...) sc_seq_register sc_set_global ($variable_01) or ({My_Field}) sc_set_language ('String Language') sc_set_regional ('String Regional') sc_set_theme ('String Theme') sc_site_ssl sc_trunc_num ({My_Field}, Decimal_Number) sc_url_exit (URL) sc_warning 'on' or 'off' sc_zip_file ("File", "Zip") events This macro shows a Javascript alert message screen. This macro modify the application execution property. This macro calculate verify digits. This macro returns "true" if the field name have been changed. This macro shows a Javascript confirm screen. This macro returns the encrypted field or variable to its original value. This macro returns the field or variable with the content encrypted. This macro Interrupts the application execution if there are error messages generated by the macro "sc_error_message". This macro generate an error message. This macro forces the application exit. 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. This macro dynamically modify the field label displayed in groupby lines. This macro loads images passed as parameter to use in the application. This macro its used to "include" PHP routines. This macro its used to select dynamically the application libraries. This macro its used to modify dynamically the grid form field label. This macro returns the language and regional settings. This macro dynamically creates or modifies links between grid applications and other applications. This macro will add a register into the log table. This macro returns what was inserted in the "description" field of the log table in an array format. This macro its used to send e-mails. This macro is used to create a string with the link data to another application. This macro update a Master Application object from a Detail Application. This macro its used to redirects to other application or URL. This macro delete session variables received as parameter. This macro provide the register sequential number. This macro its used to register session variables. This macro allows to dynamically change the application language. This macros allows to dynamically change the application regional settings. This macro its used to dinamically define the application themes. This macro verifies if its been used a safe/secure site. (https protocol) This macro its used to set the number of decimals. This macro modifies the application exit URL. This macro dynamically activates or deactivates warning messages control. This macro its used to generate ZIP files from a file list and/or directories. file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/... 28/09/2012 ScriptCase Macros Página 4 de 54 variáveis report pdf Report PDF Variables variáveis totalização Totalling Variables variáveis totalizacao(quebras) Totalling Variables (group by) Page numbers variables used in Report PDF Variables that contains all the totals (general and for grouping). Breaking totals variables. Buttons sc_btn_copy sc_btn_delete sc_btn_display ("Button_Name","on/off") sc_btn_insert sc_btn_new sc_btn_update 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. This macro activate toolbars buttons on the application 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. Menu sc_appmenu_add_item ("String Menu_Name", "Id_Item", "Id_Parent", "Label", "Aplication", "Parameters", "Icon", "Hint", "Target") sc_appmenu_create ("String Menu_Name") sc_appmenu_exist_item ("Menu_Name", "Id_Item") sc_appmenu_remove_item ("Menu_Name", "Id_Item") sc_appmenu_reset ("String Menu_Name") sc_appmenu_update_item ("Menu_Name", "Id_Item", "Id_Parent", "Label", "Aplication", "Parameters", "Icon", "Hint", "Target") sc_menu_delete (Id_Item1) sc_menu_disable (Id_Item1) sc_menu_item sc_script_name This Macro adds dinamically an item to the menu. This macro dynamically creates a menu item. This macro checks if there is a menu item. This macro removes dynamically a menu item. This macro reset the array used in the dinamically creation of a menu application. This macro updates a menu item. This macro remove items of the menu structure. This macro deactivate menu structure items. This macro Identifies the application selected in a menu items. This macro identifies the application that was selected in the menu itens. sc_add_line_tit(Title1, Colspan, Align, Background Color, Font Size, Font Color, Font Type); This macro must be called on a Grid onScriptInit event only. The "align, background color, font size, font color, font type" parameters are optional. If left empty the Title Line settings will be used. In align parameter you can use these options: Parameter C R L Macro Scope Description Center Right Left *If you use this macro, you must disable Select Column option in the Toolbar. You can add many lines as you want, just repeat the macro for each line. file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/... 28/09/2012 ScriptCase Macros Página 5 de 54 sc_ajax_javascript( 'JavascriptMethodName', array("parameter")) This macro allows the execution of methods javascript called from events in form/control applications. This macro receive two parameters: a required one that recive a parameter as string with the Javascript method name on it and an optional that recive a parameter as an array with javascript 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 Control Form onBlur onChange onClick onFocus onValidateFailure Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll Onchange OnClick OnFocus onValidate onValidateFailure onValidateSuccess sc_ajax_message("Message", "Title", "Parameters", "Parameters_Redir") Esta macro permite que a aplicação exiba mensagens customizáveis, com seu uso restrito aos eventos do formulário/controle quando se faz uso no eventos AJAX. Esta macro só é valida em aplicações com suporte a AJAX. Paramêtros Mensagem Título Descrição Texto que será exibido no corpo da mensagem. Este parametro é de preenchimento obrigatório. Texto que será exibido no título da mensagem. Se não preenchido o título da mensagem não será exibido. String de Parametros Parâmetro de formatação da mensagem. da mensagem Ex.: modal=Y&button=Y&button_label=Ok&redir=form_employees.php&redir_target=_blank Os detalhes deste parâmetro estão detalhados na tabela2. String de parametros Nesta propriedade podem ser definidos os valores para a aplicação de redirecionamento.Esta propriedade do Redirecionamento funciona apenas se a propriedade redir for informada. Os parametros devem ser informados no seguinte formato: parametro=valor;parametro=valor. Ex.: customer_id=ALFKI;customer_name=ALBERT FRANCINET Tabela2: String de Parâmetros da mensagem Propriedade modal timeout button Descrição Flag para exibição da mensagem em modal Tempo em segundos para esconder mensagem. Se não informado mensagem será exibida indefinidamente. Esta propriedade só funciona se a propriedade button não estiver habilitada. Exibe botão dentro da mensagem. O seu funcionamento padrão é Valores Y ou N Segundos Y ou N modal=Y timeout=5 button=Y Exemplo file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/... 28/09/2012 1: sc_alert("This is an alert message!!"). or a Grid starts by filter. etc. "Value") This macro allows to modify the property of the application. 28/09/2012 . Properties for Form applications Property Value Description file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. Mesmo quando esta propriedade está ativa a exibição do icone depende da configuração do Tema (Esquema de exibição) usado na aplicação. Esta propriedade quando ativa força a exibição da barra de titulo mesmo que o parametro titulo esteja vazio. Caso seja habilitado o redirecionamento.ScriptCase Macros Página 6 de 54 fechar a mensagem. "timeout=0"). Flag para exibição do botão de fechar mensagem localizado na barra de titulo. 01 sc_ajax_message ("Message".php&redir_target=_blank show_close=Y body_icon=N Nome da aplicações ou URL para redirecionamento. Flag para exibição do icone do corpo da mensagem. Esta opção só funciona caso a propriedade button habilidata Valor para posicionamento da mensagem em pixels Valor para posicionamento da mensagem em pixels Valor para largura da mensagem em pixels Valor da altura da mensagem em pixels String Apenas numeros Apenas numeros Apenas numeros Apenas numeros button=Y&button_label=OK top=300 left=200 width=320 height=30 button=Y&redir=form_employees. Ex. Esta propriedade funciona apenas quando a propriedade redir está habilitada.. "Property".php redir=form_employees. Target para url de redicionamento. Macro Scope Control Form onBlur onChange onClick onFocus Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterUpdate onAfterUpdateAll Onchange OnClick OnFocus onNavigate onValidate onValidateFailure onValidateSuccess sc_alert("Message") This macro shows a Javascript alert message screen. button_label top left width height redir redir_target show_close body_icon Label do botão. String Y ou N Y ou N Ex. This macro must be used by one application to modify the properties of another application. "Title".. Esta propriedade String funciona apenas caso a propriedade button esteja habilitada. Macro Scope Control Form onLoadAll onValidate sc_apl_conf("Application". após fechar a mensagem a aplicação será redirecionada. The user can determine if a Form will start in insert mode. "new"). sc_apl_conf("my_form". "field_display_on". Ex. sc_apl_conf("my_form". Ex. Ex. "rows". Forces the number of lines for each page (only for form of multiple records). Forces the number of columns. 5: Forces the "my_grid" application to start by filter. Property for Grid applications Property start cols rows lig_edit on/off Value filter Description Forces the Grid to start by the filter. sc_apl_conf("my_grid". Dinamically set the "readonly" attribute in order to select the field. 3: Sets "my_field" on the application "my_form" (readonly attribute) to "true" dinamically. "field_display_off". The values are: "on" to activate and "off" to deactivate. "filter"). sc_apl_conf("my_form". "start". 28/09/2012 . "Status") Used to control the security access. "my_field"). file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. Dinamically hides a field. 7: Hides "my_field" on the application "my_form" dinamically . Qualifies (on) or unqualifies (off) the "add new" button to allow the addtion of new records.. sc_apl_conf("my_form". "add". 1: Forces the "my_form" application to start in the addition mode. Ex. sc_apl_conf("my_grid". Dinamically shows a field. "20"). 'off').ScriptCase Macros Página 7 de 54 start insert update delete field_display_off field_display_on field_readonly rows rows_ins new on/off on/off on/off field field field Forces the form to start in the insert mode in order to add new records. Ex. sc_apl_conf("my_form". These macros activate/deactivate the applications that a user has acess to. Status: Is the value or variable that contains the value to be attributed to the application. 2: Doesn't allow the "my_form" application make addition of new registers. Qualifies (on) or unqualifies (off) the "delete" button on the form. Forces the number of lines for insert (only for form of multiple records). 1: sc_apl_status ('atu_cad'. Ex. Macro Scope Blank application onExecute Grid application onApplicationInit onClick onScriptInit Control Form onApplicationInit onScriptInit onValidate onValidateFailure onValidateSuccess Search application onApplicationInit onScriptInit Form application onApplicationInit onScriptInit Menu application onApplicationInit onLoad sc_apl_status("Application". (vertical and slide kind) Forces the number of lines per page.. Application: Is the name or the variable that contains the name of the application to be activated/deactivated. Ex. "off"). Ex. (the pencil icon) Property for all applications Property exit Value apl/url Description Forces application to exit to a specified location. "start". Qualifies (on) or unqualifies (off) the record edition. "my_field"). "field_display_off". 4: Shows "my_field" on the application "my_form" dinamically. Qualifies (on) or unqualifies (off) the "save" button on the form. 6: Forces the "my_grid" application to show 20 lines. "my_field"). "Label". Ex. For roots the null/empty value is passed.ScriptCase Macros Página 8 de 54 Ex.'Category Form'. 3: Adds a on the menu_main (item_2) the the item_1 named Category linked to the form_category. "Id_Parent".'item_1'. Target for menu item link.param2=valor Path to icon used in menu item. 28/09/2012 . sc_appmenu_add_item('menu_main'. Macro Scope Menu application onApplicationInit onLoad sc_appmenu_create("String Menu_Name") This macro initializes the array used in the dimanically creation of the menu application. "Hint". Descriptive hint to menu item. Parameter Menu_name Id_item Id_Parent Label Aplication Parameters Icon Hint Target Description Application menu name. Menu item id. 2: Adds a on the menu_main the the item_1 named Category. This macro must be used in control events or onload menu event.'form_category'). "_blank" to a new one and "_parent" to exit the window. ("_self" to use the same window. It must be informed the menu application name as parameter.: param1=valor.'item_1'. Ex. "Aplication". 2: sc_apl_status ({var_name_appl}. "Id_Item". Menu item description. To use this macro is necessary to execute the macro sc_appmenu_create before.'Category'.''). 1: sc_appmenu_create('menu_main'). sc_appmenu_create('menu_main'). "Parameters". "Target") Adds dinamically an item to a menu application. Ex. "Icon". Menu item URL or application name String with parameters to pass to the menu item application. Parent menu item id.. sc_appmenu_add_item('menu_main'.'item_2'. Macro Scope Menu application onApplicationInit file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. Macro Scope Blank application onExecute Grid application onApplicationInit onClick onScriptInit Control Form onApplicationInit onScriptInit onValidate onValidateFailure onValidateSuccess Search application onApplicationInit onScriptInit Form application onApplicationInit onScriptInit Menu application onApplicationInit onLoad sc_appmenu_add_item("String Menu_Name"..''. {var_status}). 1: Creates a menu named menu_main. Ex. Ex. ScriptCase Macros Página 9 de 54 onLoad sc_appmenu_exist_item("Menu_Name". 'item_2')){ sc_appmenu_update_item('menu_main'. 1: if(sc_appmenu_exist_item('menu_main'.'item_2'). Ex. "Id_Item") Remove dinamically a menu item.'item_2'. It must be informed the menu application name as parameter. 28/09/2012 .. Parameter id_item Ex. ("String Menu_Name") This macro reset the array used in dinamically creation of a menu application.'item_1'. 1: sc_appmenu_reset('menu_main')..'form_category').'form_category'). } Macro Scope Menu application onApplicationInit onLoad Description Menu item id menu_name Menu application name sc_appmenu_remove_item("Menu_Name". Parâmetro menu_name id_item Macro Scope Menu application onApplicationInit onLoad Descrição Menu application name Menu item id Ex. } else{ sc_appmenu_add_item('menu_main'.'item_2'. To use this macro it is necessary to execute the macro sc_appmenu_create before.'Category Form'.'Category Form'.'item_1'. Macro Scope Menu application onApplicationInit onLoad file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. 1: sc_appmenu_remove_item('menu_main'. "Id_Item") Verify if a menu item exists and returns true or false. necessary only if the command is executed in a different database from the specified application. "Id_Item". In the other cases. they are automatically protected through transaction control.. onBeforeInsert. the events that can run this macro is dependent of the database update (onAfterInsert. "Label".'item_2'. For roots the null/empty value is passed. onAfterUpdate. "Hint". "Icon". onBeforeUpdate or onBeforeDelete). 28/09/2012 .'form_category').'Category Form'. Target for menu item link Ex. since the connection is the same of the application.. if the user wish to make transaction control. onAfterDelete. "Id_Parent".param2=valor Icone path used in menu item. Descriptive Hint for menu item. 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. Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onBlur onChange onClick onClick onFocus onLoadAll onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Search application onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange OnClick onClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Menu application onApplicationInit onExecute onLoad file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. Macro Scope Menu application onApplicationInit onLoad sc_begin_trans("Connection") This macro starts a set of transactions in the database.'item_1'. Parameter menu_name id_item id_parent Label Aplication Parameters Icon Hint Target Description Application menu item name Application menu item id Application menu item parent id. "Aplication". In form applications. Menu item URL or application name String with parameter to pass to the application menu item Ex. Application menu item description. The "connection" parameter is optional.: param1=valor.ScriptCase Macros Página 10 de 54 sc_appmenu_update_item("Menu_Name". "Target") Updates an application menu item dinamically. 1: sc_appmenu_update_item('menu_main'. "Parameters". To use this macro it is necessary to execute the macro sc_appmenu_create before. . off). } else { sc_block_display(personal. 1: if (sc_btn_copy) { sc_message("Record copied successfully!"). } Macro Scope file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. By default all the blocks are displayed ("on" condition). 1: if ({type_customeri} == "personal") { sc_block_display(company. off). } Macro Scope sc_btn_delete Available when the "Delete" button is clicked. this macro only works with "slide" orientation. Ex. allowing especific programmation in run time. Ex. 28/09/2012 . Can be tested and used inside the ScriptCase events. } Obs: In grids. Macro Scope Grid application onScriptInit Control Form onClick onLoadAll onRefresh onScriptInit Form application onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess sc_btn_copy Available when the "Copy" button is clicked.. 1: if (sc_btn_delete) { sc_error_message("Unable to delete this record"). Can be tested and used inside the ScriptCase events. on/off) Dynamically determines the display fields of a specific block. Ex. allowing especific programmation in run time.ScriptCase Macros Página 11 de 54 sc_block_display(Block_Name. Buttons Name (Grid): Buttons Name first back forward last filter pdf pdfbw xls xml cvs rtf word print summary new insert update delete qsearch Description Goes to the first page of the grid. Generates black and white PDF. Goes to the previous page of the form. Buttons Name (Form): Buttons Name first back forward last new insert update delete copy qsearch Description Goes to the first page of the form. Displays the "Filter" button. Displays the "Copy" button of the form.. Displays the "Include" button of the form. 2: If we use variables or fields ({Fields} or [Global_Variables]) as parameters its not allowed the use of the quotes or single quotes. Displays the "New" button. Ex. Generates the Word. Remember that the buttons name must be lowercase. (only for forms running in grid´s iframe) Displays the "Delete" button of the form (only for forms running in grid´s iframe) Displays the "Quick Search" button in the grid. Generates the RTF. sc_btn_display ({variavle_button}. Generates the XML.ScriptCase Macros Página 12 de 54 Form application onValidate onValidateFailure onValidateSuccess sc_btn_display("Button_Name". Displays the "Quick Search" button of the form. or if the form is running in the grid iframe) Displays the "Include" button of the form. Displays the "Update" button of the form. Generates the XLS. Goes to the next page of the grid. Displays the "Delete" button of the form. OBS. Generates colored PDF. 'off'). Goes to the last page of the form. 28/09/2012 . Goes to the last page of the grid. Goes to the next page of the form. Displays the "Print" button in the grid. Displays the "Exit" button on a control. (only for forms running in grid´s iframe) Displays the "Update" button of the form.."on/off") Activate toolbars buttons on the application in execution time. (if the application has link for it. Displays the "New" button on the form. Goes to the previous page of the grid. if its off the form will starts in insertion mode. file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. Displays the "Summary" button in the grid. Ex. 'off'). 1: sc_btn_display ('new'. Button_Name: Is the variable name that contains the name of the button to be activated/deactivate. Buttons Name (Control): Buttons Name ok exit Description Displays the "Ok" button on a control. Generates the CVS. } Macro Scope file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. allowing especific programmation in run time. } Macro Scope Form application onLoad sc_btn_update Available when the "Save" button is clicked.. allowing especific programmation in run time.. Can be tested and used inside the ScriptCase events. Ex. Can be tested and used inside the ScriptCase events. Ex. allowing especific programmation in run time. Can be tested and used inside the ScriptCase events. Ex. 1: if (sc_btn_insert) { sc_message("Record inserted successfully"). 1: if (sc_btn_new) { {My_Date} = date('Y/m/d').ScriptCase Macros Página 13 de 54 Macro Scope Grid application onScriptInit Control Form onLoadAll onRefresh onScriptInit onValidate onValidateFailure Form application onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess sc_btn_insert Available when the "Add" button is clicked. 1: if (sc_btn_update) { sc_error_message("Record updated successfully"). 28/09/2012 . } Macro Scope Form application onValidate onValidateFailure onValidateSuccess sc_btn_new Available when the "Add New" button is clicked. Default value is the "98765432" values. 1: if (sc_changed({my_field})) { Echo "Filed have been changed".. Ex.2 = 9 Ex. 3x2=6 . 2: sc_calc_dv({my_dv}. 98765432.. Variable that will recieve the "rest" of the division.6 = 4 Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onApplicationInit onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onApplicationInit onBlur onChange onClick onClick onFocus onLoadAll onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Search application onApplicationInit onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onApplicationInit onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange OnClick onClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Menu application onApplicationInit onExecute onLoad sc_changed({Field_Name}) Macro to check if the field name have been changed. 28/09/2012 . Default value is module "11". 2). 1: sc_calc_dv({my_dv}. Module. Value or Variable containing the weights to be used. 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. Ex. 4x5=20 . 5x4=20 . 1234567. Parameter Digit Rest Value Module Weights Type Description Variable that will recieve the calculated digit. 10. 3x6=18 . Weights. 1).ScriptCase Macros Página 14 de 54 Form application onValidate onValidateFailure onValidateSuccess sc_calc_dv(Digit. Default value is "1". {my_rest}. 2x1=2 . Value or Variable to calculate the digit. Value or Variable containing the module to be used. file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. 2x7=14 . Parcels calculation: 7x2= 14 . Parcels calculation: 7x2= 14 . Rest. 1x8=8 Parcels sum : 14 + 18 + 20 + 20 + 18 + 14 + 8 = 112 Rest of the division of 112 / 11 = 2 Digit: 11 . 12. 11. 4x1=4 . 6x1=6 . 5x2=10 . 1x2=2 Parcels sum: 1 + 4 + 6 + 1 + 0 + 4 + 6 + 2 + 2 = 26 Rest of the division of 26 / 10 = 6 Digit: 10 . Value. Type) Calculate verifier (checksum) digits. 1234567. {my_rest}. 6x3=18 . "New_Connection02"). 1: To change the connections: sc_change_connection ( "Old_Connection". "New_Connection". 28/09/2012 .. Ex. Allows to change more then one application/connection in one command. in any of these events. 2: To use variables or change the main connection as follows: sc_change_connection ([Global_Connetion]. only. since the connection is the same of the application." (semicolon). use an application redirectioning (macro "sc_redir") must before the redirect. The "connection" parameter is optional. they are automatically protected through transaction control.ScriptCase Macros Página 15 de 54 } Macro Scope Grid application onGroupBy Control Form onRefresh Form application onBeforeUpdate onValidate onValidateFailure onValidateSuccess sc_change_connection("Old_Connection". onBeforeUpdate or onBeforeDelete).. onAfterUpdate. onBeforeInsert. The exchanges take effect in the following applications Macro Scope sc_commit_trans("Connection") This macro has the objective to confirm a transaction set in the database. In form applications. onAfterDelete. Multiple connections can be passed as parameters that must be separated by ". if the command is executed in a different database specified to the application. If the user. "New_Connection") This macro dynamically change the application connections. Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onBlur onChange onClick onClick onFocus onLoadAll onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Search application onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange onClick OnClick OnFocus onLoad onLoadRecord onNavigate Menu application onApplicationInit onExecute onLoad file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. Ex. [Test_Connection]). use this macro to guarantee the transactions previously effected. 3: To delete the exchange: sc_reset_change_connection (). the events that can run this macro is dependent of the database update (onAfterInsert. Ex. "Old_Connection02". being necessary. "-". 1: sc_confirm ("Do you really wish to execute this action??"). Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onApplicationInit onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onApplicationInit onBlur onChange onClick onClick onFocus onLoadAll onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Search application onApplicationInit onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onApplicationInit onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate onClick OnClick OnFocus onLoad Menu application onApplicationInit onExecute onLoad file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. 3: {inclusion_dt} = sc_date(date('Ymd'). D. M. 1). Ex. 0. 0. Ex.. 1. Ex. This macro is used to confirm that the action must be really executed. Number of Years to increment or decrement. 28/09/2012 . try it in any event: echo "form_date =". For its use are necessary some parameters as follows: Parameter Description Date Format Operator D M Y Date field that contains the date to be modified. 15. "-". 0)..ScriptCase Macros Página 16 de 54 onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess sc_confirm("Message") Valid only in the PHP programming code that runs when called through a toolbar button. Formatting thats the date field is. 2). Number of days to increment or decrement. "yyyymmdd". {name of the field date}. "+" for increment and "-" for decrement. Number of months to increment or decrement. preventing mistakes. 2: $new_date = sc_date({birthdate}. Macro Scope Grid application onClick Control Form onClick Form application onClick sc_date(Date. Ex. 1: {birthdate} = sc_date({birthdate}). "yyyy-mm-dd". 3. "Format". OBS: To be certified of the date format. "+". 30. before use the function. "dd/mm/yyyy". Y) This macro has the aim to calculate the increment or decrement of dates. "Operator". "db_format". "Output_Format") This macro converts the date field passed as parameter with an input format to another field with an output format. "Format Date2") Calculates the difference between two dates (passed as parameters) in days. "Format Date1". Ex. Used to reference Months. Ex. "dd/mm/aaaa". Value or Variable containing the date format stored on Date1. "aaaammdd").ScriptCase Macros Página 17 de 54 onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess sc_date_conv({Field_Date}. "Input_Format". "dd/mm/aaaa". 1: file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. "db_format"). 1: Converts the date from "dd/mm/yyyy" format to the "yyyymmdd" format. Used to reference Days. 28/09/2012 .. Parameter Date1 Format Date1 Date2 Format Date2 Description Date1 value or variable. {field_date} = sc_date_conv({field_date}. {field_date} = sc_date_conv({field_date}. 3: Converts the date from the "dd/mm/yyyy" format to the Database native format. Parameter Description A or Y M D Used to reference years. "dd/mm/aaaa"). {field_date} = sc_date_conv({field_date}. 2: Converts the date from the database native format to "dd/mm/yyyy" format. {Date2}. Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onBlur onChange onClick onClick onFocus onLoadAll onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Search application onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange onClick OnClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Menu application onApplicationInit onExecute onLoad sc_date_dif({Date1}. Ex. Date2 value or variable. Value or Variable containing the date format stored on Date2.. Ex. Db_Format Used to get the Dadabase date format. 2: {amount_days} = sc_date_dif("2000-05-01". 2: {differences} = sc_date_dif_2 ("2000-05-01". "mm/dd/yyyy". {Date2}. {date2}. "04/21/2004". 3: Using the option 2 {differences} = sc_date_dif_2 ("2000-05-01". 1: {differences} = sc_date_dif_2 ({date1}. where the index 0 have the amount of days. months and years. The result is returned in an array structure. file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. 2). 2 = Considers the initial day. {differences[0]} = 20 (days) {differences[1]} = 11 (months) {differences[2]} = 3 (years) Ex. "mm/dd/yyyy". {dif_months} = {differences[1]}. Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onApplicationInit onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onApplicationInit onBlur onChange onClick onClick onFocus onLoadAll onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Search application onApplicationInit onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onApplicationInit onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange onClick OnClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Menu application onApplicationInit onExecute onLoad sc_date_dif_2({Date1}. {amount_days} would be equal to 1451 (days) Note: Formats can be different but must be in days. months and years. "Format Date2". Value or Variable containing the date format stored on Date1. "Format Date1". "aaaa-mm-dd". Option) Calculates the difference between two dates (passed as parameters) returning the amount of days. 1). "mm/dd/yyyy". {dif_days} = {differences[0]}. Ex. "mm/dd/aaaa"). "yyyy-mm-dd". Date2 value or variable. Ex. 28/09/2012 . {dif_years} = {differences[2]}. "yyyy-mm-dd". Ex. 1). 1 = Doesn't consider the initial day.ScriptCase Macros Página 18 de 54 {amount_days} = sc_date_dif({date1}. Parameter Date1 Format Date1 Date2 Format Date2 Option Description Date1 value or variable. "04/21/2004". Value or Variable containing the date format stored on Date2. "aaaa-mm-dd".. "yyyy-mm-dd". "04/21/2004". the index 1 have the amount of months and the index 2 have the amount of years.. {date2}. "mm/dd/aaaa"). . months and years Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onApplicationInit onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onApplicationInit onBlur onChange onClick onClick onFocus onLoadAll onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Search application onApplicationInit onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onApplicationInit onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange onClick OnClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Menu application onApplicationInit onExecute onLoad sc_date_empty({Field_Date}) This macro checks if a date field is empty.ScriptCase Macros Página 19 de 54 {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. Ex. } Macro Scope Blank application onBeforeUpdateAll Grid application onClick onHeader onRecord Control Form onBlur onChange onClick onFocus onLoadAll onRefresh Search application onRefresh OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange onClick OnClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. 28/09/2012 . 1: if (sc_date_empty({my_date}) ) { sc_error_message ("Invalid Date"). Ex. Note: Netmake isn't responsible by the encrypting algorithm integrity. the encrypted field or variable. 2: Encrypting an user variable: $field_cript = sc_encode($my_var). Ex. 1: Encrypting a local variable: $field_cript = sc_encode({my_field})..ScriptCase Macros Página 20 de 54 sc_decode({My_Field}) Returns. Ex. Note: Netmake isn't responsible by the cryptography algorithm integrity (it is an open source algorithm) Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onApplicationInit onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onApplicationInit onBlur onChange onClick onClick onFocus onLoadAll onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Search application onApplicationInit onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onApplicationInit onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange onClick OnClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Menu application onApplicationInit onExecute onLoad sc_encode({My_Field}) Returns the field or variable with the content encrypted. to its original value. Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onApplicationInit onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onApplicationInit onBlur onChange onClick onClick onFocus onLoadAll onRefresh onScriptInit Search application onApplicationInit onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onApplicationInit onBeforeDelete Menu application onApplicationInit onExecute onLoad file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. 1: Using a local variable: {my_field} = sc_decode($field_cript).. (The algorithm provided is open source). 2: Using an user variable: $my_var = sc_decode($field_cript). 28/09/2012 . Ex. . delete or update. } sc_error_message({sc_error_delete}). } Macro Scope Control Form onScriptInit Form application onBeforeDelete onBeforeInsert onBeforeUpdate sc_error_delete This variable returns a string with a database error message. trigger treatment. Ex.. "]"). 28/09/2012 . returning an error message generated by database trigger using MsSQL. sees the macro "sc_error_continue". {sc_erro_insert} and/or {sc_erro_update} The events to be passed as parameter are: insert. It can be used in along with variable: {sc_erro_delete}. sc_error_continue("delete"). if (!empty({sc_error_delete})) { $tmp = strrpos({sc_error_delete}. 1: Content of the variable {sc_erro_delete}. 1: Using on the event onDelete for the message returned by mssql. $tmp 1).ScriptCase Macros Página 21 de 54 onValidate onValidateFailure onValidateSuccess onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange onClick OnClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess 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. sc_error_exit. Ex. which cancels the record exclusion.” Note: To access the database return error.“[Microsoft] [ODBC SQL Server Driver] [SQL Server] You can't erase this register. Macro Scope Form application onAfterDelete file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. if ($tmp !== false) { {sc_error_delete} = substr({sc_error_delete}. displays a error message in the format [Microsoft] [ODBC SQL Server Driver] [SQL Server] You can't erase the record. in case of database validations via triggers or procedures that they return messages. It is used when there is a need to treat these messages. which occurs by trying to exclude a record. Like for example. . It is used when is neede to treat these messages. see the macro "sc_error_continue". The target parameter its opicional.. an "OK" button is displayed. returning an error message generated by database trigger the using mssql “[Microsoft] [ODBC SQL Server Driver] [SQL Server] You can't add this register. "Target") or (My_Application. Ex.mysite. If informed an URL or the name of an Application. 28/09/2012 . Ex. that occurs when adding a record. displaying the error messages. if there is error message generated through " sc_error_message" macro.com). Ex. 1: Variable {sc_erro_insert}. 1: file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. Ex. sc_error_exit(my_application. 2: Display the error messages and the "OK" button to redirect to URL. For example. except when using the "sc_error_exit" macro. "_blank"). opening in another window. Ex. In "Grid and Menu" applications the messages only will be presented through the "sc_error_exit" macro.” Note: To access the return of the database error. In "Form and Control" applications.ScriptCase Macros Página 22 de 54 sc_error_exit(URL. in case of database validations via triggers or procedures that return message. Macro Scope Blank application onBeforeUpdateAll Control Form onBlur onChange onClick onFocus onLoadAll onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Search application OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange OnClick OnFocus onNavigate onValidate onValidateFailure onValidateSuccess sc_error_insert This variable returns a string with the database error. sc_error_exit(). "Target") Interrupts the application execution. 3: Display the error messages and the "OK" button to redirect to Application. bellow the error messages to redirect the processing to the informed URL/Application. the messages are presented together with other error messages found in the application. sc_error_exit(http://www. 1: Displays only the error messages. Macro Scope Form application onAfterInsert sc_error_message("Text") This macro generates an error messages. 10 and the user try to add or save this record. 28/09/2012 . Required only. Macro Scope Blank application onBeforeUpdateAll Control Form onBlur onChange onClick onFocus onLoadAll onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Search application OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange OnClick OnFocus onNavigate onValidate onValidateFailure onValidateSuccess sc_error_update This variable returns a string with a database error message that occurs when updating a record.10 && [glo_usr] == 'operator') { sc_error_message("Discounting of " . if the command is executed in a data base different from the application. " above of the allowed one").” Note: To have access the return of database error see the macro "sc_error_continue". Ex. "Connection") This macro allows to condition the circumstances thats the SQL commands are executed. The "Connection" parameter is optional. } In this example. For example. in case of database validations via triggers or procedures that return message. } Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onBlur onChange onClick onClick onFocus onLoadAll Search application onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate Menu application onApplicationInit onExecute onLoad file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. if the value in the discount field is over 0.ScriptCase Macros Página 23 de 54 if ({discount} > 0.The command must finish with "). Macro Scope Form application onAfterUpdate sc_exec_sql("SQL Command"." (close parentheses and semicolon) used as delimiter for the macro interpreter. It is used when there is a need to treat these messages. Ex.. returning an error message generate by a database trigger using mssql. 1: if (sc_after_delete) { sc_exec_sql("delete from mytable where key = {key_ant}"). “[Microsoft][ODBC SQL Server Driver][SQL Server] You can't updatethis record.. 1: Variable {sc_erro_update}. {discount} . the operation is finished and the error message is presented. Macro Scope Control Form onClick onScriptInit Form application onClick onScriptInit sc_field_color("Field". Otherwise. repeat the application select. display the OK button. Commit pending transactions. sc_field_color ("customerid".sel) Description Returns to the previous application without display anything. use the default color. Same of the sc_exit(sel) function. Opton sc_exit() sc_exit(c) sc_exit(r) Description Doesn't complete transactions in database. 28/09/2012 . if the value is greater that 1000. } Ex. Ex. 2: Change the "value_order” field text color. however. file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/.ref) sc_exit(ok. ""). "#33FF66").ScriptCase Macros Página 24 de 54 onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess onAfterUpdateAll onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange OnClick onClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess sc_exit(Option) This macro can be used in the ScriptCase events and created button and may return values/process after the execution. Doesn't display the window with an OK button refresh data and returns to the current application. 3: Using a local variable. {fld_color}).. This option is only valid for Form and Control Applications. Option sc_exit() sc_exit(ok) sc_exit(sel) sc_exit(ref) sc_exit(ok. Displays a window with an OK button adn returns to the previous application. however. "Color") This macros its used to change/restore a grid field text color dynamically. Same of the sc_exit(ref) function. "#33FF66"). Rollback pending transactions. display the OK button. sc_field_color ("customerid". 1: Change the grid text field “customer_id” color. Doesn’t display the window with an OK button and returns to the current application. Ex.. } else { sc_field_color ("value_order". if ({value_order} > 1000) { sc_field_color ("value_order". "U" to block only the update. Fields that its going to be blocked should be followed by the option "true" (default) or "false". Field_02. 1: if ({tp_customeri} == "personal") { sc_field_display({company_name}. 1: Blocks only one field for addition and update. sc_field_disabled("Field_01"). 4: Combination of block and unblock of several fields. sc_field_color ("customerid". Field_03=true"). Macro Scope Control Form onLoadAll Form application onLoad onNavigate sc_field_display({My_Field}. "I" its used only to block de addition of new records. Ex.. 2: Unblocking a field for addtion and update. By default all the fields are display ("on" condition"). off). Field_03". in case of the parameter has not been informed the scriptcase will use both options. 4: Using a global variable. sc_field_disabled("Field_01=true. Ex. sc_field_disabled("Field_02=false"). sc_field_disabled("Field_01. "Parameter") This macro its used to block a field to get any data that would be typed on it. The parameter its optional..ScriptCase Macros Página 25 de 54 Ex. only for update. } else { sc_field_display({personal_name}. "U"). Ex. Macro Scope Grid application onRecord onScriptInit sc_field_disabled("Field_Name = True/False". Ex. 28/09/2012 . off). [glo_color]). Ex. 3: Blocks several fields. on/off) This macro dynamically display a specific field. Field_02=false. for adition and update. } Macro Scope Blank application onBeforeUpdateAll Grid application onScriptInit Control Form onBlur onChange onClick onFocus onLoadAll onRefresh onScriptInit onValidate onValidateFailure Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onBeforeInsertAll Onchange file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. 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}).ScriptCase Macros Página 26 de 54 OnClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess sc_field_init_off(Field1. used by an ajax event to define if a field its going to be read-only (On) or read-only (Off). "Background-Color". Macro Scope Blank application onBeforeUpdateAll Control Form onBlur onChange onClick onFocus onLoadAll onRefresh onScriptInit onValidate onValidateFailure Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onBeforeInsertAll Onchange OnClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess sc_field_style({My_Field}.. 28/09/2012 .) This macro is intended to inhibit the query fields on the initial load. "Family". "Size".. section "Read-Only". Macro Scope Grid application onApplicationInit sc_field_readonly({Field}.. The on/off parameter its opitional. Ex 01: sc_field_init_off ({orderID}. Fields inhibited by this macro can be enabled by using the "Columns" button. Otherwise set this parameter on / off on the form interface. } Ex. {TotalValue}).. "Color". on/off) This macro dynamically set a form field attribute to 'ReadOnly'. 2: To set a field as read only dynamically use: sc_field_readonly({my_field}). Use this macro only to do it at 'runtime'.. "Weight") file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. Field2. sc_format_num({my_value}. 3: Formatting a value with 4 decimals and filling with zeros.234.. Decimals separator symbol. Input value = 0012345678. 'S'. Ex. "Amount_Dec". ''). (1 = left and 2 = right). (1 = left and 2 = right) Monetary symbol to be displayed. Parameter Field Background-Color (optional) Size (optional) Color (optional) Family (optional) Weight (optional) Description Name Field cell background Color Field font size Font Color Font family Font weight Ex. '. Side_Currency_Symb Currency symbol position. sc_format_num({my_value}.'. Integer values grouping symbol.9 Output value = US$ 12. 28/09/2012 . ''). 'S'. '#000000'. "Side_Neg".678 Ex. '.678. 5: Formatting a value with 2 decimals. Negative sign position.'. 'US$').'.9000 Ex. Input value = 0012345678. 1: Formatting an integer. "Currency_Symb". sc_format_num({my_value}. '. '1'.. Input value = 0012345678. '1'. 0. 2.90Output value = -12.90 Ex. 4: Formatting a value with 2 decimals. '15px'.'. ''). ''. sans-serif'. 'S'. filling with zeros and using monetary symbol. ''). "Fill_Zeros". ''. '1'. 'N'.678. '#33FF99'. 4. Input value = . 'Arial. "Group_Symb". filling with zeros.'. 2: Formatting a negative value and truncating decimals. "Side_Currency_Symb") This macro its used to format numerical values.345. sc_format_num({my_value}. '.567. 'bold'). 'N'. Macro Scope Grid application onRecord onScriptInit sc_format_num({My_Field}. '. Input value = 001234567890 Output value = 1.345. '.'. 0.890 Ex.'.345. Parameter My_Field Group_Symb Dec_Symb Amount_Dec Fill_Zeros Side_Neg Currency_Symb Description Variable or field to format (The return is in the next variable). '.ScriptCase Macros Página 27 de 54 This macro allows to modify the grid field style dinamically. '1'.90 Macro Scope Blank application onBeforeUpdateAll onExecute Grid application onApplicationInit onClick Control Form onApplicationInit onBlur Search application onApplicationInit onRefresh Form application ajaxFieldonBlur onAfterDelete Menu application onApplicationInit onExecute file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. '1'.'. 1: sc_field_style({my_field}. Complete decimals with zeros (fill in) (S = yes and N = no).9 Output value = 12. '.9 Output value = 0. 2. "Dec_Symb". sc_format_num({my_value}. Number of decimals to be displayed. ScriptCase Macros Página 28 de 54 onFooter onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit onChange onClick onClick onFocus onLoadAll onRefresh onScriptInit onValidateFailure onValidateSuccess onSave onScriptInit OnValidate onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onApplicationInit onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange OnClick onClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess onLoad sc_form_show'on' or 'off' This macro dynamically display or not a form. alert (cli_js. By default. allowing the user to access the object properties. 28/09/2012 . This macro will run on control and forms at the javascript events and methods.. 1: Doesn't display the form. Macro Scope Control Form onLoadAll onScriptInit Form application onLoad onScriptInit onValidate sc_getfield('myField') This macro is used to assign objects (that represent the field's form) to a javascript variable. Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onApplicationInit onClick onGroupBy onHeader onNavigate Control Form onApplicationInit onBlur onChange onClick onClick Search application onApplicationInit onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll Menu application onApplicationInit onExecute onLoad file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/..value). sc_form_show = 'off'. 1: $my_language = sc_get_language(). Macro Scope sc_get_language This macro returns the abbreviation of the language used. Ex. EX: Showing the value of the "client" field of a form cli_js = sc_getfield('cliente'). the form is displayed ("on" condition). Ex. Ex. Macro Scope Blank application onBeforeUpdateAll onExecute Grid application onApplicationInit onClick Control Form onApplicationInit onBlur Search application onApplicationInit onRefresh Form application ajaxFieldonBlur onAfterDelete Menu application onApplicationInit onExecute file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. 28/09/2012 . Ex. 1: $my_regional = sc_get_regional(). Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onApplicationInit onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onApplicationInit onBlur onChange onClick onClick onFocus onLoadAll onRefresh onScriptInit onValidateFailure onValidateSuccess Search application onApplicationInit onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onApplicationInit onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange OnClick onClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Menu application onApplicationInit onExecute onLoad sc_get_theme This macro returns the application theme used.ScriptCase Macros Página 29 de 54 onNavigate onRecord onScriptInit onFocus onLoadAll onRefresh onScriptInit onValidateFailure onValidateSuccess onAfterUpdate onAfterUpdateAll onApplicationInit onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange OnClick onClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess sc_get_regional This macro returns the abbreviation of the regional settings used.. 1: $my_theme = sc_get_theme().. ScriptCase Macros Página 30 de 54 onFooter onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit onChange onClick onClick onFocus onLoadAll onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess onSave onScriptInit OnValidate onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onApplicationInit onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange OnClick onClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess onLoad sc_groupby_label("My_Field") This Macro dynamically modify the field label displayed in group by lines. Ex. Ex.jpg) This macro its used to copy images in some events or Javascript commands to load images to an application. Macro Scope Grid application onGroupBy sc_image(Image01. To catalogue the scripts go to the ScripCase main menu at "Tools > Library" and use the "upload" option existing in the interface. 1: sc_groupby_label('state') = "state grouping". Macro Scope Blank application onExecute Grid application onApplicationInit onScriptInit Control Form onApplicationInit onLoadAll onScriptInit onValidateFailure onValidateSuccess Search application onScriptInit Form application onApplicationInit onClick onLoad onLoadRecord onScriptInit onValidate Menu application onApplicationInit onLoad sc_include("File". img2.gif. 28/09/2012 . Ex. file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/.jpg). 1: sc_image (img1. Note: The images must exist in the development environment images directory (. "Source") The Scriptcase allows the user to catalogue his PHP scripts to use in various applications.. 2: sc_groupby_label('balance') = "balance total". All images used in the applications are automatically copied to each application.../devel/conf/sys/img/img/). usr). 1: JavaScript Libraries Jquery jquery_thickbox jquery_blockui tiny_mce file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/.php). the user has the option of the context choice where it will be stored. . PHP Libraries fpdf fpdf_html excel rtf Ex. . . group level or user level.) This macro its used to select dynamically the application libraries. sc_include(my_script. Ex. 28/09/2012 .php.php.Project: Only the project users (the one's that will be loged at that time) will have acess.Usr: User level... The Source context that the script was saved. . global level (Scriptcase). 1: Including a catalogued script to global level. .Prj: Group level. Ex. Ex. "Lib2". 2: Including a catalogued script to the group level. 3: Including a catalogued script to the user level. . Macro Scope Blank application onBeforeUpdateAll onExecute Grid application onApplicationInit onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onApplicationInit onBlur onChange onClick onClick onFocus onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Search application onApplicationInit onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onApplicationInit onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange onClick OnClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Menu application onApplicationInit onExecute onLoad sc_include_lib("Lib1".User: Only the user (the one's that will be loged at that time) will have acess. the user must inform the script name that will be included and the source. grp)..ScriptCase Macros Página 31 de 54 When a script is catalogued.. sc_include(my_script. .Sys or Blank: Scriptcase global level. sc_include(my_script. that could be: .Public: All the projects will have acess.Script Name: Script name to be included. The sc_include macro. $pdf->SetFont('Arial'.10.. $pdf=new FPDF(). Application. 3: Using a global variable. sc_label({Customer}) = "Cust Name". $pdf->AddPage(). Ex. Parameters. 28/09/2012 . Ex. Application: Application name to establish the link. Parameters: Parameters required by the called application. "Target".16). Macro Scope Grid application onNavigate onNavigate onScriptInit Control Form onLoadAll onScriptInit Form application onLoad onLoadRecord onNavigate onRefresh onScriptInit sc_language This macro returns the language and regional settings. 1: Using the field name. 2: Using a variable as paramenter. Height. sc_label([global_variable]) = "Cust Name". $pdf->Cell(40.{sc_language}. Ex. file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. $pdf->Output(). Column: Grid column field name to generate the link.ScriptCase Macros Página 32 de 54 sc_include_lib ("fpdf").'B'.. "Hint". sc_label("Customer") = "Cust Name". 1: echo "Language: ". Macro Scope Blank application onFooter sc_label({My_Field}) This macro its used to modify dynamically the grid form field label. Macro Scope Blank application onExecute Grid application onApplicationInit onScriptInit Control Form onApplicationInit onScriptInit onValidate onValidateSuccess Search application onApplicationInit onScriptInit Form application onApplicationInit onScriptInit Menu application onApplicationInit onLoad sc_link(Column. Ex.'Hello World!'). Width) This macro dynamically creates or modifies links between grid applications and other applications. "iframeR"). "_blank").. product=[global_costumer]. Opens a new window and blocks any interaction in the main window. In the case of modal target. To run on another page (pop-up).com. sc_link (my_field. type_f. the left of the Grid (Left)." Company Data ". passing the global variable [global_costumer] as and the product field (local variable) {Id} to the costumer. } else{ sc_link (costumer_type. "Client Data". More than one parameter must be separated by ". Id={Id}. costumer. "paramater and target" have no effect. Ex. there are two optional parameters *: *Height: Set the height of the modal window (default 440). product=[global_costumer].php." (semicolon). Id={Id}. 3: Creating a link to an URL: in this case.php. *Width: Set the width of the modal window (default 630).php. "modal". product=[global_costumer].ScriptCase Macros Página 33 de 54 Must be informed "=" (attribution sign) . the left of the Grid (Left). if ({costumer_type} == "F") { sc_link (costumer_type. Hint: Observation or tip displayed when the mouse cursor passes over the link. 500.scriptcase. It will be executed redirecting to a informed URL. 700). will be assigned the value "_self". type_a. Id={Id}. Macro Scope Grid application onRecord sc_lin_cod_barra_arrecadacao Macro Scope Blank application onExecute onFooter Grid application onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onValidate onValidateSuccess Form application onBeforeInsert onBeforeUpdate onClick onLoad onLoadRecord onNavigate onRefresh onValidateSuccess sc_lin_cod_barra_banco file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. 2: Creating a dynamic link to another application depeding on the field valor {costumer_type} and opening it in a modal. Ex. . To run in an iframe below the Grid (Bot).php application: sc_link(Id." Personal Data ". Target : Where the application will function call and may be: Target "_self" "_blank" "iframeT" "iframeL" "iframeR" "iframeB" "modal" Descrição For carrying on the same page (overrides the query). on the Id field.php application. http://www. 1: Creates a link to the costumer. To run in an iframe. Note: If omitted. 28/09/2012 . To run in an iframe.. } Ex."hint of the link"). To run in an iframe above the Grid (top). Ex: sc_log_add ("access". 28/09/2012 . The information is stored in the "description" field of the log table in the string format with delimiters. "Application has been accessed by the user trial"). The macro parameters can use PHP variables. Ex: file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. thereby making the message and / or the name of the action customizable to the developer. "description") This macro is intended to add a record to the log table. allowing the manipulation of the data before and after the record update returning it in an array mode.ScriptCase Macros Página 34 de 54 Macro Scope Blank application onExecute onFooter Grid application onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onValidate onValidateSuccess Form application onBeforeInsert onBeforeUpdate onClick onLoad onLoadRecord onNavigate onRefresh onValidateSuccess sc_lin_digitavel_arrecadacao Macro Scope Blank application onExecute onFooter Grid application onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onValidate onValidateSuccess Form application onBeforeInsert onBeforeUpdate onClick onLoad onLoadRecord onNavigate onRefresh onValidateSuccess sc_lin_digitavel_banco Macro Scope Blank application onExecute onFooter Grid application onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onValidate onValidateSuccess Form application onBeforeInsert onBeforeUpdate onClick onLoad onLoadRecord onNavigate onRefresh onValidateSuccess sc_log_add("action"... Macro Scope sc_log_split({description}) This macro is intended to provide access to the information written in the last insertion in the log table. {credit_limit} = {my_data[0][2]}.. } elseif (empty({my_data})) { echo "Select command didn't return data". Use when the command is executed in a database different from that specified for the application. If occurs error in the execution of the SQL command. customer_name. Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onClick onGroupBy onHeader onNavigate onNavigate onRecord Control Form onBlur onChange onClick onClick onFocus onLoadAll Search application onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate Menu application onApplicationInit onExecute onLoad file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. use: {customer_id} = {dataset[1][0]}. use : {customer_id} = {dataset[0][0]}. if ({my_data} === false) { echo "Access error. 2: sc_lookup(my_data. The "connection" parameter is optional. "SQL Command". {my_data_erro} . The "dataset" structure is an array (line/column). once the output array only will be created if the select command returns data.". 28/09/2012 . 3: The SQL command also can be composed of application fields (local variables) or of global variables: sc_lookup(dataset. "select customer_id. "select customer_id. Ex. credit_limit from customers"). } else { {customer_id} = {my_data[0][0]}. 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.ScriptCase Macros Página 35 de 54 $arr_description = sc_log_split({description}). the variable attributed to the dataset will return as " false" and the error message will be available in the "dataset_erro" variable. customer_name. {customer_name} = {my_data[0][1]}. credit_limit from customers" ). To have access to the second line (Dataset). It is also important to verify the select returned data. 1001 [City] => Peixinhos [State] => PE ) ) ) Macro Scope sc_lookup(Dataset. Message=". Ex. {customer_name} = {dataset[1][1]}. Note2: For a big result returned in the dataset we recomend the use of the macro sc_selec instead of this one. "Connection") This macro allows the user to execute SQL commands and returns the result to the "dataset" variable.. 1: sc_lookup(dataset. } Ex. To have access to the first line (Dataset). {credit_limit} = {dataset[1][2]}. {credit_limit } = {dataset[0][2]}. "select order_value from orders where clienteid = '{customer_id} ' and salesman_id = [var_glo_salesman]"). {customer_name} = {dataset[0][1]}. Note: The command must always finished with semicolon ". to prevent access to inexistent variables. } file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. Ex. 1: sc_mail_send('smtp. } else { sc_erro_mensagem({sc_mail_erro}). 'from@netmake. (String or Variable that contains the subject) Message body.ScriptCase Macros Página 36 de 54 onScriptInit onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess onAfterUpdateAll onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange onClick OnClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateSuccess sc_mail_send(SMTP. Attachment) This macro its used to send emails. 'CCC'. 'H'. sc_mail_send([glo_smtp].com. {subject}. [usuar]. 'H'. 3: No user and password. {to}. the variable "sc_mail_ok" will recieve "false" and the error message will be stored on the variavle "sc_mail_erro". To. {message}. ''. 'H'. 'c:/test/arq. the ScripCase will assume the default value: 25 for not secure port and 465 for secure port. it could be a string or variable that cointains one or more emails separated by ". Ex. 'usr'. [glo_att]).com. 'to@netmake. 'S'." or one variable that contains one array of emails.br'. {to}. Ex.br'. ''. From. {subject}.. ''.br. 2: Usising variables and defining the port. ''. ''. The amount of emails sent will be stored at the special variable "sc_mail_count". Type copies: BCC (Hiden copies) or CCC (Regular copies).br'. it could be a string or variable that cointains one or more emails separated by ". Mens_Type.com. 'Message'. '419'. {message}. 'Test Email Subject'. Message subject. ''. (String or Variable that contains the server name) SMTP user name.br'.br'. Ex. Copies_Type. 'abc@cop. If omited. '[email protected]. {attached}). {to}. (String or Variable that contains the message) Message format: (T)ext or (H)tml. Server port. Usr.txt'). List of the emails that will recieve the message. Copies. Port.com. [glo_copias]. Connection security (S) or (N). 'H'). Connection_Type. Subject. Pw. ''. ''.zxy@cop. Parameter SMTP Usr Pw From To Subject Message Mens_Type Copies Copies_Type Port Connection_Type Description SMTP server name or IP address. ''. {sunject}. (String or Variable that contains the email) List of the emails that will recieve the message. 28/09/2012 . (String or Variable that contains the password) From email. 'T'.4 : sc_mail_send([glo_smtp]. [glo_pw]. {message}.netmake. {from}. Note: To use safe connection its required to have the PHP "php_openssl" extension enable.br'. if ({sc_mail_ok}) { echo "sent {sc_mail_count} e-mail(s) with sucess!!". Message.meuserver.com." or one variable that contains one array of emails. sc_mail_send([glo_smtp].. If any error happend when the scriptcase try to send the email. 'pw'. 'from. (String or Variable that contains the user name) SMTP password. ''. "SELECT SUM(Total) FROM adm_pedido_itens WHERE PedidoID = '{PedidoID}'"). 2: Creating a string with a link for the application datacli.php application. Ex. 1: sc_lookup(result. without parameters passage." (semicolon). sc_master_value('ValorPedido'. [valor] = {result}[0][0]. The value can be a field or a variable.ScriptCase Macros Página 37 de 54 Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onClick onLoadAll onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Search application onSave onScriptInit OnValidate Form application onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate onClick onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Menu application onApplicationInit onExecute onLoad sc_make_link(Application. Its Not necessary the {} in a field name.. with parameters passage. In the format: "=" (the attribution sign) . 28/09/2012 . 1: Creating a string with a link for the datacli. parm1={company}.parm2=[glo_office]). Ex. $string_link = sc_make_link(datacli. Ex. Parameters) This macro creates a string containing a link to other Scriptcase application (when writing html code). Parameters necessary so called application. $string_link = sc_make_link(datacli. [valor]).php.php). More than one parameter must be separated by ". Parameter Application Parameters Description Name of the application to establish the link. Parameter Object Value Description Object name to be updated in Master Application. Macro Scope Blank application onExecute onFooter Grid application onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onValidate onValidateSuccess sc_master_value('Object'. Object value. file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/.. Value) This macro update a Master Application object from a Detail Application. 1: To clean global variable. Ex. } file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. 28/09/2012 . if ({sc_menu_item} == "item_5" && (!isset([glo_employ]) || empty([glo_employ]))) { sc_redir(apl_inf_emp).. [global2]). Menu items are deactivated recursively (when a submenu item is deactivated its “nodes” are also deactivated).. Macro Scope Menu application onApplicationInit onLoad sc_menu_disable(Id_Item1) This macro deactivates menu items pass as parameters. The parameters passed are items "ID”.ScriptCase Macros Página 38 de 54 Macro Scope Control Form onLoadAll onRefresh onScriptInit Form application onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onApplicationInit onBeforeDelete onBeforeInsert onBeforeUpdate onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure sc_menu_delete(Id_Item1) This macro removes menu items passed as parameters. Can be use in menu applications or tree menu. } Ex. 2: If an application requires a global variable another application can initialize it accordingly. If a menu item its removed and it have "nodes". Macro Scope Menu application onApplicationInit onLoad sc_menu_item This variable its only avaliable for menu application and has the objective of giving acess to a menu item that was selected. this way the user can take desicions before de called application runs. if ({sc_menu_item} == "item_1") { sc_reset_global([global1]. Can be used in menu applications or tree menus. Observe that the parameters used in this macro are the "ID" of the items. they will be hidden too. EX: sc_redir(employee. if ([global_user] == "test") { sc_redir(http://www. must be separated by semicolon (. parm1={var_test}.php). If the redir uses parameters. 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. 3: Application without parameters and with target. Parameter01. _parent. } OBS. onAfterDelete. "_blank"). 3) More than one parameter.. "". if ([global_user] == "test") { sc_redir(application_x. these must be passed in the following format: 1) After the name of the application. if ([global_user] == "test") { sc_redir(application_x. } Ex. parm2="xxx". OBS. Ex.php application the parameters will be acessible at [parm1] and [parm2] Macro Scope Blank application onBeforeUpdateAll onExecute Grid application onApplicationInit onClick onNavigate onNavigate onScriptInit Control Form onApplicationInit onClick onLoadAll onRefresh onScriptInit onValidate Search application onScriptInit OnValidate Form application onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll Menu application onApplicationInit onExecute onLoad file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. 5: URL.my_page. } Ex.) 4) The target determine which application is opened (default=_self): _self. onBeforeInsert.) then 2) = (equal sign) . Error) This macro its used to redirect the processing to other application or URL. 2: Application with parameters and without target. 4: Application with parameter and target. } Ex. In the employee. Target. parm2="xxx"). onafterupdate.. "_parent"). use the comma delimiter (. 28/09/2012 . Everthing that was passed as parameter to the called application will be avaliable as global variable. } Ex.com). if ([global_user] == "test") { sc_redir(application_x. 1: Application without parameters nor target. "_blank").php. if ([global_user] == "test") { sc_redir(application_x. parm2="xxx". Parameter02. If your connection uses transaction control the use of this macro on the events onAfterInsert. onbeforeupdate or onBeforeDelete should come after the use of macro sc_commit_trans so this way it will save the form changes.ScriptCase Macros Página 39 de 54 Macro Scope Menu application onExecute sc_redir(Application. parm1={var_test}. parm1={var_test}. _blank or modal. 28/09/2012 .. 1: Deleting the modifications of the "my_application" application. 3: Deleting the modifications of all the applications. sc_reset_apl_conf(). 1: sc_reset_apl_status().ScriptCase Macros Página 40 de 54 onValidateFailure onValidateSuccess onApplicationInit onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate onClick onLoad onScriptInit onValidate onValidateSuccess sc_reset_apl_conf("Application".. Macro Scope Blank application onExecute Grid application onApplicationInit onScriptInit Control Form onApplicationInit onScriptInit onValidate onValidateSuccess Form application onApplicationInit onScriptInit Menu application onApplicationInit onLoad file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. "start"). Macro Scope Blank application onExecute Grid application onApplicationInit onClick onScriptInit Control Form onApplicationInit onScriptInit onValidate onValidateSuccess Search application onApplicationInit onScriptInit Form application onApplicationInit onScriptInit Menu application onApplicationInit onLoad sc_reset_change_connection This macro has the objective to erase the changes made using the macro "sc_change_connection". Ex. "Property") This macro have the objective to delete all modifications effected by the sc_apl_conf macro. 2: Deleting the modifications of the "my_application" application. Ex. Ex. Macro Scope Blank application onExecute Grid application onApplicationInit onClick onScriptInit Control Form onApplicationInit onScriptInit onValidate onValidateSuccess Search application onApplicationInit onScriptInit Form application onApplicationInit onScriptInit Menu application onApplicationInit onLoad sc_reset_apl_status This macro has the objective to clean all security variables. The property parameter its opicional. set through the sc_apl_status macro. if its passed it will only erase the modification from that specific application. property "start". Ex. sc_reset_apl_conf("my_application"). sc_reset_apl_conf("my_application". [Pass]). deleted by the macro "sc_menu_delete"..) This macro has the objective to delete global variables.. Macro Scope Menu application onApplicationInit onLoad sc_reset_menu_disable This macro have the objective to enable a menu item. stored in the PHP session. Macro Scope Menu application onApplicationInit onLoad file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. 1: sc_reset_menu_delete(). Ex. 1: sc_reset_global ([Login].. 1: sc_reset_menu_disable(). Ex. Ex.ScriptCase Macros Página 41 de 54 sc_reset_global([Global_Variable1].. [Global_Variable2] . Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onApplicationInit onClick onGroupBy onHeader onRecord onScriptInit Control Form onApplicationInit onBlur onChange onClick onClick onFocus onLoadAll onScriptInit onValidate onValidateFailure onValidateSuccess Search application onApplicationInit onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onApplicationInit onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange onClick OnClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Menu application onApplicationInit onExecute onLoad sc_reset_menu_delete This macro its used to restore a menu item. disabled by the macro "sc_menu_disable". 28/09/2012 . use only if the command is executed in a different data base from the specified to the application. limitecred from costumers"). } Macro Scope Grid application onScriptInit Menu application onExecute sc_select(dataset. Ex. clientName. "SQL Command". "Connection") This macro executes the SQL commands passed as parameter and access the "dataset" in the command. Macro Scope Blank application onBeforeUpdateAll onExecute Grid application onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onBlur onChange onClick onClick onFocus onLoadAll onRefresh onValidate onValidateFailure onValidateSuccess Search application onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange onClick OnClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Menu application onApplicationInit onExecute onLoad sc_script_name This macro is available to the MENU applications to access the application name that was selected in the menu. Enable to select before the application is executed if a pre-process is required to an application..ScriptCase Macros Página 42 de 54 sc_rollback_trans("Connection") This macro its used to cancel a transaction set in the database. 1: sc_select(my_data. this macro doesn't manipulate the dataset (the user is responsible for all the manipulation). The "Connection" parameter is optional. 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. 28/09/2012 . if ({my_data} === false) { file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. [global2]). "select clientId. use only if the command is executed in a data base different from the specified in the application. Different from sc_lookup macro. if ({sc_script_name} == "apl1") { sc_reset_global([global1].. 1: To clean global variables. Ex. The connection parameter is optional. displays the years and only a specific month. } else { while (!$my_data->EOF) { {clientName} = $my_data->fields[1]. Note: The command must always be finished with semicolon".". } Ex."select price order from order where clientId = '{clientId}' and cod_Seller = [var_glo_seller]"). value from table order by code. To change the order. 2: Select Clause: select code. Ex. Passing the parameter as a global variable named "show_month". pair_month from table sc_select_field(pair_month) = [show_month]. Note: This command must be in the context of the evento "onInit". Modify the select.. in the application is found the following structure: Select Clause: select year. use: sc_select_order("code") = "name". $my_data->MoveNext(). Ex. 2: The SQL command can passed as application fields (local variables) or of global variables. 1: A table with the columns year and the months from January to December is used to create a grid using a parameter. during the grid execution time. It is possible. Macro Scope file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. 28/09/2012 .ScriptCase Macros Página 43 de 54 echo "Access error. {my_data_erro}. modify the grid ORDER BY clause. name. Message =".. and the grip column label. } $my_data->Close(). sc_label(pair_month) = [show_month]. At least one ORDER BY is required in the original grid SQL command to allow the substitution execution during the grid time. Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onBlur onChange onClick onClick onFocus onLoadAll onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Search application onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange onClick OnClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Menu application onApplicationInit onExecute onLoad 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. from code to name. sc_select(dataset. } else { sc_select_where(add) = "AND campoX > [global_variable]". Note: This command must be in the context of "process before the select". only in onRecord event. Ex. At least one ORDER BY is required in the original grid SQL command to allow the substitution during the grid execution time. Ex. date FROM table ORDER BY code. name. if (empty({sc_where_current})) { sc_select_where(add) = "where campoX > [global]". during grid execution time to add a field/condition to the search WHERE clause. Ex. we will have: sc_select_order("code") = "name". price. name. 1: Select Clause: SELECT code. Ex. price FROM table ORDER BY code To change the order from code to name. It can be used. modify the grid ORDER BY clause. price To change the order from name to date...ScriptCase Macros Página 44 de 54 Grid application onScriptInit sc_select_order("Field") It is possible. } Note: This command must be in the context of "process before the select". we will have: sc_select_order("name") = "date". } Macro Scope file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. 1: if({sc_seq_register} == 10) { // last line of the page {total} = {sum_total}. during the grid execution time. 2: Select Clause: SELECT code. name. 1: It adds the contente between the quotes (") in the grids select. 28/09/2012 . Macro Scope Grid application onScriptInit sc_select_where(add) Is possible. Macro Scope Grid application onScriptInit sc_seq_register This macro provide the record (being processed) grid sequential number. Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onApplicationInit onClick onGroupBy onHeader onRecord onScriptInit Control Form onApplicationInit onBlur onChange onClick onClick onFocus onLoadAll onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Search application onApplicationInit onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onApplicationInit onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange onClick OnClick OnFocus onLoad onLoadRecord onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Menu application onApplicationInit onExecute onLoad sc_set_language('String Language') This macro allows to define the application language dinamically. Note: This macro doesn't attribute values. 1: Changes the laguage to English. sc_set_global($my_var). 2: Changes the laguage to Spanish. Macro Scope Control Form onApplicationInit onLoadAll onRefresh onScriptInit Form application OnClick onLoad onRefresh onValidateSuccess sc_set_global($variable_01) or ({My_Field}) This macro its used to register global variables. Ex. Ex. file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/.ScriptCase Macros Página 45 de 54 sc_set_focus('Field') This macro its used to set the focus to a form field. Ex. sc_set_global({fieldname}). Ex. 1: sc_set_focus('name').. 28/09/2012 . 1: Registering a users variable. Create a session variable with the same name and content of the local variable. Only register the session variables from PHP . Creates a session variable with the name "my_var" with the "mary" content.. $my_var = "mary". Ex. 2: For register a field value as a session variable. sc_set_language('en_us'). " 2) Even using the macro.ScriptCase Macros Página 46 de 54 sc_set_language('es'). Ex. 4: Changing the language to Eslovak and regional settings to Slovak Republic.sc_set_rtf_name .csv".sc_set_xml_name . Macro Scope Blank application onExecute Grid application onApplicationInit onScriptInit Control Form onApplicationInit onScriptInit onValidate onValidateSuccess Search application onApplicationInit onScriptInit OnValidate Form application onApplicationInit onScriptInit Menu application onApplicationInit onLoad sc_set_pdf_name"sc_my_file_name. sc_set_language('de. XLS. Ex.sk_sk').xls". Ex..sc_set_csv_name . It still allows to define the language and regional settings of the applications using a delimiter ". can use the following macros: . sc_set_language('en_us." between the parameters. the Scriptcase will delete the file when it reaches the configured timeout limit (see the setting "File Lifetime" in the production environment). To assign different names Scriptcase patterns.sc_set_xls_name Ex1: sc_set_xls_name = "my_file. 28/09/2012 . CSV and RTF) are stored in "temporary" directory specified in the Scriptcase's configuration in development and in production. XML.. NOTE: 1) These macros should be used in the event "onScriptInit. with the prefix "sc_" followed by a unique identification so the file of a user does not overwrite to one another.de_lu'). remained the prefix "sc_" (as Ex2). Ex2: sc_set_csv_name = "sc_my_new_file. 1: Changing the language to English and regional settings to Canada.es_mx'). 2: Changing the language to Spanish and regional settings to Mexico.en_ca'). sc_set_language('es. sc_set_language('sk.sc_set_pdf_name . The prefix "sc_" makes Scriptcase delete the old files. Ex.pdf" The resulting files of the exported data (PDF. Macro Scope file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. 3: Changing the language to Germanian and regional settings to Luxembourg. Macro Scope Blank application onBeforeUpdateAll Grid application onApplicationInit Control Form onApplicationInit Search application onApplicationInit Form application onAfterDelete Menu application onApplicationInit file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/.. Ex. 2: Using a negative.Unsafe site".com/") . 1: sc_set_regional('en_us'). if (!sc_site_ssl) { echo "Warning . } Ex. } Ex. Ex.. if (sc_site_ssl) { echo "ok . Macro Scope Blank application onExecute Grid application onApplicationInit onScriptInit Control Form onApplicationInit onScriptInit onValidate onValidateSuccess Search application onApplicationInit onScriptInit OnValidate Form application onApplicationInit onScriptInit Menu application onApplicationInit onLoad sc_set_theme('String Theme') This macros allows to define the application theme dinamically. (https protocol) Ex.Safe site". 28/09/2012 . if (!sc_site_ssl) { sc_redir("http://www.erro_page.ScriptCase Macros Página 47 de 54 sc_set_regional('String Regional') This macros allows to dynamically change the application regional settings. 3: Redirecting if the site isn't safe. } Note: This macro works only to the web server llS. 1: sc_set_theme('Newyellow'). Macro Scope Blank application onExecute Grid application onApplicationInit onScriptInit Control Form onApplicationInit onScriptInit onValidate onValidateSuccess Search application onApplicationInit onScriptInit OnValidate Form application onApplicationInit onScriptInit Menu application onApplicationInit onLoad sc_site_ssl This macro its used to verifie if a used site is a safe site. 1: Using an affirmative. Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onBlur onChange onClick onFocus onLoadAll onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Search application onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange onClick OnClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Menu application onExecute onLoad sc_sql_protect(Value. "Connection") This macro will protect the value passed as paramenter according with the used database. have protection against "sql injection".. 2: Protecting an user variable: $field_protect = sc_sql_injection($my_var). Ex. file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. "Type". Ex. 28/09/2012 .ScriptCase Macros Página 48 de 54 onExecute onClick onScriptInit onClick onLoadAll onScriptInit onValidate onValidateFailure onValidateSuccess onScriptInit onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onApplicationInit onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate onClick onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess onLoad sc_sql_injection({My_Field}) or ($My_Variable) This macro its used to protect the field/variable against "sql injection".. sc_select or sc_exec_sql. generated for the Scriptcase. Note: that all database accesses. if not informed scriptcase will use the default connection. The "Type" parameter so far can only use the "Date" value. Macro used for protection against "sql injection" in commands generated by the developer when using the macros: sc_lookup. the "Connection" parameter is opicional. 1: Protecting a local variable: $field_protect = sc_sql_injection({my_field}). Ex. Input value = 1250.2 Output value = 1250. 28/09/2012 . sc_select_where(add) = " AND news_noticias.00 Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onApplicationInit onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onApplicationInit onBlur onChange onClick onClick onFocus onLoadAll onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Search application onApplicationInit onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onApplicationInit onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange OnClick onClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Menu application onApplicationInit onExecute onLoad file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/.235 Output value = 1250..23 Input value = 1250.sc_sql_protect($data_final. Decimal_Number Amount of decimals to display. "date")." AND ". 2). Decimal_Number) This macro its used to truncate numerical values."". "date").ScriptCase Macros Página 49 de 54 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. 1: sc_trunc_num({my_value}. exceeding the amount of decimals specified. Parâmetro My_Field Descrição Variable with value to format (return in the same variable).20 Input value = 1250 Output value = 1250.noticia_data_pub BETWEEN ".sc_sql_protect($data_inicial.. Macro Scope Blank application onBeforeUpdateAll onExecute Grid application onRecord Control Form onLoadAll onValidate Search application OnValidate Form application onAfterDeleteAll onAfterInsertAll onAfterUpdateAll onBeforeDeleteAll onBeforeInsertAll onValidate sc_trunc_num({My_Field}. 1: sc_url_exit(http://www.. an item of an inexistent array. etc. Ex.ScriptCase Macros Página 50 de 54 sc_url_exit(URL) This macro modifies the application exit URL.scriptcase.php). 2: sc_url_exit(aplx.. Warning messages are generated when a reference is made to an inexistent variable. sc_warning = 'off'.net). Ex. Ex. 28/09/2012 . Macro Scope Blank application onBeforeUpdateAll Grid application onApplicationInit onClick onNavigate onNavigate onRecord onScriptInit Control Form onApplicationInit onClick onLoadAll onScriptInit onValidate onValidateFailure onValidateSuccess Search application onApplicationInit onScriptInit Form application onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onApplicationInit onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate onClick onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess sc_warning'on' or 'off' This macro dynamically activates or deactivates warning messages control. Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onApplicationInit onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onApplicationInit onBlur onChange onClick onClick onFocus onLoadAll onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Search application onApplicationInit onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onApplicationInit onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate Onchange onClick OnClick OnFocus onLoad onLoadRecord onNavigate onRefresh onScriptInit Menu application onApplicationInit onExecute onLoad file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. 1: To deactivate the message (do not display). Ex. Macro Scope Blank application onFooter Grid application onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit sc_where_orig This macro saves the application original select where clause. 1: $save_current_filter = {sc_where_filter}. 1: $save_where = {sc_where_orig}. "Zip") file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. Reflects the where clause currently used.. Can be used inside the scriptcase events. Ex. or to display in anywhere in the grid. to treat the information. 28/09/2012 .ScriptCase Macros Página 51 de 54 onValidate onValidateFailure onValidateSuccess sc_where_current Variable to reference the original command where clause and the last selection through the form filter. Ex. Macro Scope Blank application onFooter Grid application onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit sc_zip_file("File". according with the filter form selections. Macro Scope Blank application onFooter Grid application onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit sc_where_filter This macro its used to save the variable to reference results generated by "filter".. 1: $save_current_where = {sc_where_current}. This information will be added to the application original select where clause. sc_glo_senha_cript Encrypted password (S/N). sc_glo_decimal_db Used decimal separator (point or comma). or a variable containing its name. Connected user name. The zip parameter must be the zip file name generated. A variable a file or a directory name.zip"). sc_zip_file("/test/sample. Database password access. Macro Scope Blank application onBeforeUpdateAll onExecute onFooter Grid application onApplicationInit onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onApplicationInit onClick onLoadAll onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Search application onApplicationInit onSave onScriptInit OnValidate Form application onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onApplicationInit onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate onClick onLoad onLoadRecord onNavigate onRefresh onScriptInit onValidate onValidateFailure onValidateSuccess Menu application onApplicationInit onExecute onLoad Database Variables Global variables containing database access values used by main connection. Database name. mysql. 1: Only a file. etc).. Ex. Database type (mssql.zip")..htm". 2: Only a directory. Variables sc_glo_servidor sc_glo_banco sc_glo_tpbanco sc_glo_usuario sc_glo_senha Description Server name. Ex. which contains a files and/or directories list. 28/09/2012 . file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. $prep = array(). which contains a files and/or directories list. "/tmp/test. $prep[] = "/test/sample. The file parameter must be one of the following: File name Directory name A variable containing array. oracle.htm".zip"). sc_zip_file($prep. "/tmp/test.ScriptCase Macros Página 52 de 54 This macro its used to generate ZIP files from a list of files and/or directories. "/tmp/test. sc_zip_file("/test". $prep[] = "/test". Ex. A variable containing array. 3: Using an array of files and directories. Ex. 1: $my_database = [sc_glo_banco]. 28/09/2012 . Field “Balance” total. Current break level records total. sc_db_master_cript Encrypted password (S/N) (see sc_encode macro). use the following variables: Variables sc_db_master_usr Description User login to be used. Field {sc_page_tot} Description Total number of pages. Scriptcase generates total variables to each break level. $temp_pass = sc_encode({password}). These data must be used to connect to the database. {sum_break_balance} Current break level field “Balance” total. 2: An application type "control" with a form created with information "login" and encrypted "password". as in: Variables {count_ger} {sum_parcel} {sum_balance} {count_break} {sum_break_parcel} Description Records total amount. Macro Scope Blank application onExecute onFooter Grid application onClick onGroupBy onHeader onNavigate onNavigate onRecord onScriptInit Control Form onBlur onChange onClick onClick onLoadAll onRefresh onValidate onValidateFailure onValidateSuccess Search application onRefresh onSave onScriptInit OnValidate Form application ajaxFieldonBlur Onchange OnClick OnFocus Menu application onApplicationInit onExecute onLoad Report PDF Variables Page numbers variables used in Report PDF. file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. {sc_page_num} Current page number. during the system applications execution. To define user and the password to connect to the database. Current break level field “parcels” total. [sc_db_master_pass] = $temp_pass. These variables only reference the values without updating it (it is not possible to attribute/modify the values). Field “parcels” total. sc_db_master_pass Password to be used.ScriptCase Macros Página 53 de 54 Ex. [sc_db_master_cript] = "S". [sc_db_master_usr] = {login}. Macro Scope Totalling Variables During break down and summary processing. Totals special variables are then referenced substituting the break name for the key word “break”... Important: These variables only take effect during next application execution remaining valid during all the session (unless modified). The routines are defined in event “onGroupBy” determining the break levels and avalilable to each record. 28/09/2012 . Macro Scope Grid application onGroupBy file:///C:/Program%20Files/NetMake/v6/wwwroot/scriptcase/doc/manual_mp/28-Macros/. {sum_quebra_balance} Current break level field “Balance” total. Ex. Scriptcase generates total variables to each break level. Macro Scope Blank application onFooter Grid application onGroupBy onHeader onRecord Totalling Variables (group by) During the break down process. Field “Balance” total. is possible to display the average (avg) instead of the balance as follows. Totals special variables are then referenced substituting the break name for the key word “quebra”. Current break level field “parcels” total. 1: In an application with a break by state and city and that totalizes a balance field. {sum_quebra_balance} = {sum_quebra_balance} / {count_quebra}. 1: In an application with a break by state and city that totalizes a balance field. The routines are defined in event “onGroupBy” determining the break levels. Current break level records total. {sum_break_balance} = {sum_break_balance} / {count_break}. in the break totals. in the break totals. is possible to display the average (avg) instead of the balance as follows .ScriptCase Macros Página 54 de 54 Ex... Field “parcels” total. as in: Variable {count_ger} {sum_parcel} {sum_balance} {count_quebra} {sum_quebra_parcel} Description Records total amount.
Copyright © 2024 DOKUMEN.SITE Inc.