2020年5月11日 星期一

ScriptCase 關於 Application 的程式控制

關於 SC 內部Macros 裡面有幾個特定的函數,是專門來控制  應用程式  Application 的。
寫 SC 一定要有個認識,否則,程式會看不懂。


設定應用程式的屬性;例如可以設定 表單Form程式起始在新增模式、或是 表格Grid起始在搜尋等。
sc_apl_conf ("Application", "Property", "Value")  This macro modify the application execution property.
sc_reset_apl_conf ("Application", "Property")  This macro deletes all the modifications effected by "sc_apl_conf" macro.


系統預設的起始應用程式
sc_apl_default ('application', 'type');  This macro allows that the user defines in your initial application what will happen when the application lost the session.
sc_reset_apl_default   This macro can reset sc_apl_default macro settings.


安全控制:控制應用程式是否可以被使用者執行使用。
sc_apl_status ("Application", "Status")  This macro Activate/Deactivate the applications at user level.
sc_reset_apl_status    This macro deletes all the application security status variables.



sc_redir (Application, Parameter01; Parameter02; Target, Error, height_modal, width_modal)   This macro its used to redirects to other application or URL.





sc_apl_conf("Application", "Property", "Value")
設定應用程式的屬性;例如可以設定 表單Form程式起始在新增模式、或是 表格Grid起始在搜尋等。
這支 Macro 一定只能在一個應用程式中去修改另一個應用程式的屬性!
因為自己不能修改自己:自己已經啟動,已經在跑了,不能再修改自己的啟動模式。
This macro allows to modify the property of the application. The user can determine if a Form will start in insert mode, or a Grid starts by filter, etc.

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

Properties for Form applications
PropertyValueDescription
startnewForces the form to start in the insert mode in order to add new records.
inserton/offQualifies (on) or unqualifies (off) the "add new" button to allow the addtion of new records.
updateon/offQualifies (on) or unqualifies (off) the "save" button on the form.
deleteon/offQualifies (on) or unqualifies (off) the "delete" button on the form.
field_display_offfieldDinamically hides a field.
field_display_onfieldDinamically shows a field.
field_readonlyfieldDinamically set the "readonly" attribute in order to select the field.
rowsForces the number of lines for each page (only for form of multiple records).
rows_insForces the number of lines for insert (only for form of multiple records).

Property for Grid applications
PropertyValueDescription
startfilterForces the Grid to start by the filter.
colsForces the number of columns. (vertical and slide kind)
rowsForces the number of lines per page.
lig_editon/offQualifies (on) or unqualifies (off) the record edition. (the pencil icon)
Property for all applications
PropertyValueDescription
exitapl/urlForces application to exit to a specified location.
Ex. 1: Forces the "my_form" application to start in the addition mode.sc_apl_conf("my_form", "start", "new");
Ex. 2: Doesn't allow the "my_form" application make addition of new registers.sc_apl_conf("my_form", "add", "off");
Ex. 3: Sets "my_field" on the application "my_form" (readonly attribute) to "true" dinamically.sc_apl_conf("my_form", "field_display_off", "my_field");
Ex. 4: Shows "my_field" on the application "my_form" dinamically.sc_apl_conf("my_form", "field_display_on", "my_field");
Ex. 5: Forces the "my_grid" application to start by filter.sc_apl_conf("my_grid", "start", "filter");
Ex. 6: Forces the "my_grid" application to show 20 lines.
sc_apl_conf("my_grid", "rows", "20");
Ex. 7: Hides "my_field" on the application "my_form" dinamically.
sc_apl_conf("my_form", "field_display_off", "my_field");
Ex. 8: Use the button on the toolbar menu.
if ({sc_menu_item} == "btn_1")
{
sc_apl_conf("form_customer", "start", "new");
}

Macro Scope
Blank applicationcalendar applicationchart applicationGrid applicationSearch applicationForm applicationControl FormMenu applicationTree menuReportPDF application
onExecuteonApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onFilterInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onExecute
onLoad
onApplicationInit
onExecute
onLoad
onApplicationInit
onScriptInit


sc_reset_apl_conf("Application", "Property")

This macro have the objective to delete all modifications effected by the sc_apl_conf macro.
The property parameter its opicional, if its passed it will only erase the modification from that specific application.


Ex. 1: Deleting the modifications of the "my_application" application, property "start".
sc_reset_apl_conf("my_application", "start");



Ex. 2: Deleting the modifications of the "my_application" application.
sc_reset_apl_conf("my_application");



Ex. 3: Deleting the modifications of all the applications.
sc_reset_apl_conf();


Macro Scope

Blank applicationcalendar applicationchart applicationGrid applicationSearch applicationForm applicationControl FormMenu applicationTree menuReportPDF application
onExecuteonApplicationInit
onCalendarApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onFilterInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onValidate
onValidateSuccess
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onScriptInit
    




sc_apl_default('application', 'type');
專案預設的應用程式;
當系統失去連線(session)時,要讓系統返回哪一個應用程式?也就是系統起始的預設應用程式。
This macro allows that the user defines in your initial application what will happen when the application lost the session.
The macro has the following parameters:
Apl: Here it is necessary to inform which application the macro will redirect after lost the session.
Type: Here we will inform the redirecting type that will occur. There are two types:
  • R: The application will only redirect to the initial application.
  • M: Will be shown a message before the redirecting.
Example: In a login application defined as the initial application, we can define that this application will redirect to himself.
sc_apl_default("app_login","R")

Macro Scope
calendar applicationchart applicationGrid applicationSearch applicationForm applicationControl FormReportPDF application
onCalendarScriptInit
onScriptInit
onScriptInitonScriptInitonFilterInitonScriptInitonScriptInitonScriptInit
 



sc_apl_status("Application", "Status")
安全控制:控制應用程式是否可以被使用者執行使用。
Used to control the security access. These macros activate/deactivate the applications that a user has acess to.

Application: Is the name or the variable that contains the name of the application to be activated/deactivated.
Status: Is the value or variable that contains the value to be attributed to the application. The values are: "on" to activate and "off" to deactivate.
Ex. 1:
sc_apl_status ('atu_cad', 'off');


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

Macro Scope
Blank applicationcalendar applicationchart applicationGrid applicationSearch applicationForm applicationControl FormMenu applicationTree menuReportPDF application
onExecuteonApplicationInit
onCalendarApplicationInit
onCalendarScriptInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onFilterInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onValidate
onValidateFailure
onValidateSuccess
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onScriptInit
 



sc_reset_apl_default

This macro should be used when necessary to remove sc_apl_default() macro control over the applications.

Ex1:

sc_reset_apl_default();


Macro Scope

calendar applicationchart applicationGrid applicationForm applicationControl FormReportPDF application
onScriptInitonScriptInitonScriptInitonScriptInitonScriptInitonScriptInit
    





sc_reset_apl_status

This macro has the objective to clean all security variables, set through the sc_apl_status macro.

Ex. 1:

sc_reset_apl_status();


Macro Scope

Blank applicationcalendar applicationchart applicationGrid applicationSearch applicationForm applicationControl FormMenu applicationTree menuReportPDF application
onExecuteonApplicationInit
onCalendarApplicationInit
onCalendarScriptInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onApplicationInit
onFilterInit
onApplicationInit
onScriptInit
onApplicationInit
onScriptInit
onValidate
onValidateSuccess
onApplicationInit
onLoad
onApplicationInit
onLoad
onApplicationInit
onScriptInit
























    

沒有留言:

張貼留言

如何判斷現在FORM是在 insert mode? 還是 update mode?

只要用  if (empty({primary_key})) 就可以知道是否為新增模式了。 如果 {promary_key} 是空白的,那麼就是在新增模式;反之,就是更新模式。 以上。