ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Web-specific functions / Page functions
  • If the management mode of contexts via cookies is used (ctxCookie constant used in ConfigureAWPContext):
  • If the management mode of contexts on disk is used (ctxDisk constant used in ConfigureAWPContext):
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
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 Active WEBDEV Pages are displayed. This allows you to manage an AWP context. Two modes are available for managing the contexts:
  • Managing the contexts via cookies (by default).
  • Managing the contexts on disk.
The mode for managing the contexts is selected in ConfigureAWPContext. If this function is not called, contexts are managed via cookies by default.
DeclareAWPContext is taken into account in AWP mode only.
It is recommended to use this function in the project initialization event (for project variables) and/or in the page initialization event (for page variables). In most cases, this function must be used in the process where the variables are declared and initialized.
If your project uses pre-launched sessions, this function must not be used in the project initialization event. This function must be used in the "Initialize project after connecting to the site" event.
Remark: For more details:
Caution: This function requires a good knowledge of WEBDEV.
Example
// -- Code d'initialisation du projet
gnNumProduitEnCours is int = 1

// On indique qu'on souhaite sauver la valeur de gnNumProduitEnCours
// à chaque affichage d'une page AWP
DeclareAWPContext(gnNumProduitEnCours)

// Lors des prochains affichage de la page :
// - soit la valeur gnNumProduitEnCours n'est pas récupérée
// et elle est automatiquement réinitialisée avec "1"
// (par exemple, lors du premier affichage de la page)
// - soit la valeur gnNumProduitEnCours est récupérée et utilisée
// (par exemple, lors des affichages suivants)
Syntax
<Result> = DeclareAWPContext(<Name of variable 1> [, <Name of variable 2> [... [, <Name of variable N>]]])
<Result>: Boolean
  • True if the specified variables have been restored,
  • False otherwise (during the first page display for example).
<Name of variable 1>: Variable type
Name of the first variable that will be saved at the end of the display. The value of this variable will be retrieved during the successive page displays.
<Name of variable 2>: Type of variable (optional parameter)
Name of 2nd variable that will be saved at the end of display. The value of this variable will be retrieved during the successive page displays.
<Name of variable N>: Type of variable (optional parameter)
Name of Nth variable that will be saved at the end of display. The value of this variable will be retrieved during the successive page displays.
Remarks

If the management mode of contexts via cookies is used (ctxCookie constant used in ConfigureAWPContext):

  • DeclareAWPContext uses 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 simple variables (integer, string, etc.) are managed..
    Remark: For handle buffers, use the Cookie disk.

If the management mode of contexts on disk is used (ctxDisk constant used in ConfigureAWPContext):

  • DeclareAWPContext uses 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 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.
  • Simple variables (integer, string, etc.) are supported, as well variables of type:
    • structure,
    • class,
    • array,
    • associative array,
    • combination
    • enumeration
  • The following variable types are not supported:
    • fixed arrays,
    • global members of classes,
    • associative arrays of local structures,
    • references to dynamic objects.
Component: wd290page.dll
Minimum version required
  • Version 10
Comments
Click [Add] to post a comment

Last update: 02/02/2024

Send a report | Local help