PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • If the management mode of contexts via cookies is used:
  • If the management mode of contexts on disk is used:
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Allows you to declare a list of variables whose value will be persistent between the successive displays of AWP pages. This function indicates the variables that will be saved and restored whenever the AWP pages are displayed. This allows you to manage an AWP context. Two modes are available for managing the contexts:
  • Managing the contexts via cookies.
  • Managing the contexts on disk.
The mode for managing the contexts is selected in ConfigureAWPContext.
DeclareAWPContext is taken into account in AWP mode only.
This function should be used in the initialization code of project (for the project variables) and/or in the initialization code of pages (for the page variables). In most cases, this function must be used in the process where the variables are declared and initialized.
Versions 20 and later
If your project is using cached sessions, this function must not be used in the "Initializing the project" process. This function must be used in the "Initializing the project after connection to the site" process.
New in version 20
If your project is using cached sessions, this function must not be used in the "Initializing the project" process. This function must be used in the "Initializing the project after connection to the site" process.
If your project is using cached sessions, this function must not be used in the "Initializing the project" process. This function must be used in the "Initializing the project after connection to the site" process.
Note: For more details:
Caution: This function requires a good knowledge of WEBDEV.
Example
// -- Initialization code of project
gnNumCurrentProduct is int = 1

// Indicate that the value of gnNumCurrentProduct must be saved
// whenever an AWP page is displayed
DeclareAWPContext(gnNumCurrentProduct)

// During the next displays of the page:
// - either the value of gnNumCurrentProduct is not retrieved
// and it is automatically reinitialized with "1"
// (during the first display of the page for example)
// - or the value of gnNumCurrentProduct is retrieved and used
// (during the next displays for example)
Syntax
<Result> = DeclareAWPContext(<Name of Variable 1> [, ... [, <Name of Variable N>]])
<Result>: Boolean
  • True if the specified variables have been restored,
  • False otherwise (during the first display of the page for example).
<Name of Variable 1>: Type of variable
Name of the first variable that will be saved at the end of display. The value of this variable will be retrieved during the successive displays of the page.
<Name of Variable N>: Type of the variable (optional parameter)
Name of the Nth variable that will be saved at the end of display. The value of this variable will be retrieved during the successive displays of the page.
Remarks

If the management mode of contexts via cookies is used:

  • DeclareAWPContext is using the HTTP cookies. The values of variables will not be restored if the HTTP cookies are ignored by the browser used on the current computer.
  • The total size of values for the different variables cannot exceed 4KB. If the size of these values is too important, these values will be truncated (missing variable and/or truncated content).
  • DeclareAWPContext is not recommended for the sensitive data (user password for example). Indeed, the data flows via the browser. This function must NOT be used to store a user connection for example.
  • If two variables are saved with the same name (one in the project and the other one in a page for example), only the first variable will be stored.
  • DeclareAWPContext returns False if one of the variables was not restored.
  • Only the variables passed to DeclareAWPContext during a page display will be retrieved during the next display. The variables that were previously passed are not automatically saved again.
  • Only the simple variables (integer, string, ...) are supported.

If the management mode of contexts on disk is used:

  • DeclareAWPContext is using the contexts on disk. The values of variables are always restored.
  • The total size of values for the different variables is not limited.
  • DeclareAWPContext can be used for sensitive data (user password for example).
  • If two variables are saved with the same name (one in the project and the other one in a page for example), the two variables are stored independently.
  • DeclareAWPContext returns False if one of the variables was not restored.
  • All the variables passed to DeclareAWPContext during a page display can be retrieved during the next display. The variables that were passed beforehand are automatically saved again.
  • The simple variables (integer, string, ...) are supported as well as the structure, class, array or associative array variables. The fixed arrays, the global members of classes and the associative arrays of local structures are not supported.
Components
WEBDEV - Server code wd230page.dll
Linux wd230page.so
Minimum required version
  • Version 10
Comments
Click [Add] to post a comment