ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Controls, pages and windows / Graphic string functions
  • Where to use gStoredValue
  • Added value
  • Case sensitivity
  • Auto-filled combo boxes
  • Retrieved element
  • Scheduler control
  • Special case: Combo Box control or Combo in a Table control field
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Adds an "invisible" value to an element in a List Box, Combo Box or Scheduler control. This value will be the stored value when the control element is selected by the user.
Remarks:
  • To get the stored value associated with an element of the control, use the StoredValue property.
  • To retrieve the value defined by gStoredValue:
    • use the gStoredValueEnable function.
    • AndroidAndroid Widget check "Return value specified with gStoredValue" ("Details" tab of the control description).
    In this case, the control will directly return the value of gStoredValue that corresponds to the selected option.
  • This function is equivalent to gLink.
Example
// Code du champ Bouton permettant de remplir le champ Combo
// ----------------------------------------------
// La combo "COMBO_Civilité" affiche les titres de civilité :
// "Monsieur", "Madame" et "Mademoiselle".
// Un entier représentant une civilité sera retourné au langage
ListAdd(COMBO_Civilité, "Monsieur" + gStoredValue("1"))
// Seule la chaîne de caractères "1" est retournée au langage.
// Cette chaîne de caractères retournée n'est pas affichée dans le champ Combo.
// Code du champ Bouton permettant de connaître la valeur de gValeurMémorisée
// -------------------------------------------------------------------------------
// Code permettant d'obtenir la valeur du gValeurMémorisée de l'option sélectionnée 
Info(COMBO_Civilité[COMBO_Civilité].ValeurMémorisée)
// Affiche "1" dans notre exemple.
Syntax
<Result> = gStoredValue(<String to return>)
<Result>: Character string
Control string that must be used in ListAdd, ListInsert or ListModify.
<String to return>: Character string
Text value to return. Only this string will be returned to the language. This string will not be displayed in the row.
Remarks

Where to use gStoredValue

gStoredValue can be called anywhere in the row to be added.
For example:
ListAdd(COMBO_COMBO1, gStoredValue("1") + "Monsieur")
// ou
ListAdd(COMBO_COMBO1, "Monsieur" + gStoredValue("1"))

Added value

Values added with gStoredValue are not taken into account for sort operations and keyboard shortcuts.
If multiple values are added to an element of a list box with gStoredValue, only the first value will be returned.
ListAdd(LISTE_LISTE1, "MonElément" + gStoredValue("Lien1") + gStoredValue("Lien2"))
In this example, only the "Link1" value will be returned.
ListSeek takes into account the values added by gStoredValue.

Case sensitivity

gStoredValue is case-insensitive.
Therefore, the following code:
ListAdd(LISTE_LISTE1, "MonElément" + gStoredValue("AAA"))
will be equivalent to:
ListAdd(LISTE_LISTE1, "MonElément" + gStoredValue("aaa"))

Auto-filled combo boxes

gStoredValue is used to manage "Auto-filled Combo Box" controls.

Retrieved element

When an element is retrieved from a List Box or Combo Box control, the priority order is as follows:
  1. Values added by gStoredValue.
  2. Values added by gToRetrieve.
To get the stored value associated with an element of the control, use the StoredValue property.

Scheduler control

If the resources in the schedule have been created with SchedulerAddResource using gStoredValue, the name of the resource obtained with the SelectedResource property will correspond to the value specified in the gStoredValue function for this resource.
Example:
// Ajoute une ressource (ici une salle de réunion) dans le champ Planning
// Reunion est le fichier de données qui décrit les différentes salles disponibles
SchedulerAddResource(PLN_OccupationSalles, Reunion.Nom + gStoredValue(Reunion.IDReunion))

...

// Code de clic sur le bouton BTN_NOUVEAU_RDV
MonRDV is Appointment
IF PLN_OccupationSalles.RessourceSélectionnée = "" THEN
        RETURN
END

MonRDV.StartDate = PLN_OccupationSalles.DateDébut
MonRDV.EndDate = PLN_OccupationSalles.DateFin
MonRDV.Resource = PLN_OccupationSalles.RessourceSélectionnée
// Le nom de la ressource correspond à la valeur précisée 
// dans la fonction gValeurMémorisée pour cette ressource

Special case: Combo Box control or Combo in a Table control field

If gStoredValue must return an empty string (""), the result will be different if the control used is a Combo Box control or a Combo Box column in a Table control.
The following code is used:
ListAdd(COMBO, "MonElément" + gStoredValue(""))
the value retrieved will be:
  1. an empty string ("") in the case of a Combo Box control,
  2. 0 (zero) in the case of a Combo Box column in a Table control.
To use the same code to retrieve the value of gStoredValue for a Combo Box control and a Combo Box column, it is recommended to use a Combo Box control in a container column in the Table control.
Component: wd300obj.dll
Minimum version required
  • Version 27
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help