Reception of parameter via GET in applications of type Form
Sending a parameter to an application is always easy when done within the Scriptcase environment, but when working with external applications we must do it another way. That’s why using the GET type variables is a good option to receive external data in a Scriptcase Form when doing the interconnection between applications.
In Scriptcase there are three options for variables declaration: SESSION, POST and GET.
the application will be allowed to receive the value of the variable through the URL of our form. As a result, we can perform the tasks that we want within the form from initial values, since configuring initial values for the load of a new record (so that the user need to enter data already provided in external application) to more complex processes that require initial values to be started (for example:. End of the month in which the month and year to be processed within the events of our form).
All information needed to better understand parameter, the use of variables within Scriptcase can be found below by clicking here:
The following example shows the Declaration of a variable and encoding in Scriptcase Events to act differently the pre-specified to receiving the variable. You can find more information about events in the link:
Declaration of Variable “Document”
Ambit -> GET
(Scope. Ambit, Sphere)
Configuration -> Optional (In case you are always expected to receive a variable, this option should be unchecked)
Event onApplicationInit
Within the Event is validated if the variable “Document” is nonzero. If you start the form to load a new record. We made this configuration using the SC_APL_CONF (documentation) macro which we need to indicate the name of the application, the property to be configured and the desired value for the property.
Event onLoad
Within the Event it is validated if the variable “Document” is different from empty. If you assign the value of the [Document] variable to the {Document} field and set the quoted field to read only, so that you can not edit the received value. We made this configuration using the C_FIELD_READONLY (documentation) macro, which should indicate the field of our application to be set to read-only.
Clicking on “run application” will show us the following window where it is possible to enter the variable that we set, if we leave blank and click on “form_cliente” the form will execute normally showing the records that contains the related table.
To perform the tests we must modify the URL that we see in the browser excluding everything that precedes the name of our form and adding our variable and the desired value by prefixing the symbol “?”, As indicated in the following image.
Note that when you receive the variable a value, in addition to entering the “new record” move, it is set as read-only in the “Document” field and assigns the value that we send.
See more post in our blog!
You might also like…