|
|
|
WADELIA |
|
|
|
|
(I/B) (C) |
|
Section for use
All
Syntax
SET_CTX ContextKey ContextLevel SeriesVariables
ContextKey |
→ |
AlphanumConstant | AlphanumVariable |
|
|
|
ContextLevel |
→ |
'REQUEST' | 'SESSION' | 'GLOBAL_SESSION' | 'APPLICATION' |
|
|
|
SeriesVariables |
→ |
SeriesVariables Variable | Variable |
Description
This instruction lets you save, in the ContextKey key, the variables (or memory lists) defined in the SeriesVariables variables, in the implicit Request, Session or Application object (depending on the ContextLevel context level).
The GET_CTX instruction lets you retrieve the value of these variables.
If data already exists for the key and context level, this data is replaced.
In protected mode, the 'SESSION' context level applies tot he Web pseudo-session and the 'GLOBAL_SESSION' context level applies to the Web session that "hosts" all the pseudo-sessions. Values stored at 'GLOBAL_SESSION' level are accessible from all the Web pseudo-sessions, whereas values stored at 'SESSION' level are not.
This instruction updates the reserved word *RETURN_CODE:
0 (*NORMAL) |
Operation completed successfully. |
-1 |
Operation not completed successfully. |
Note: If the information you save in the context must be got from outside a WADELIA program (in a JSP or Servlet not developed using Adelia Web Studio), restrict yourself to a single variable corresponding to a simple Adelia type. In this way, the value of an Adelia variable will be retrievable as a simple Java type corresponding to the Adelia type. Additionally, in protected mode, the 'GLOBAL_SESSION' context level must be used, not the 'SESSION' level.
Click here for more information on equivalencies between Adelia types and 3GL types.
Example
* Program 1 calling
SET_CTX 'CustomerVal' 'Session' ZCUSTOMER_CODE ZCUSTOMER_NAME - ZCUSTOMER_ADD
* After running various queries in the same program or another program
*
GET_CTX 'CustomerVal' 'Session' ZCUSTOMER_CODE ZCUSTOMER_NAME - ZUSTOMER_ADD
IF *RETURN_CODE = *NORMAL
...
END
Other example
KEY_VAR = 'CustomerInfo'
SET_CTX KEY_VAR 'Session' ZCUSTOMER_CODE ZCUSTOMER_NAME - ZCUSTOMER_ADD
See also the list of 4GL instructions by topic