AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Sintaxis WLanguage / Declaración de variables
  • Handling a composite variable
  • Type of the members in a composite variable
  • Declaring an array member in a structure
  • Limits of a composite variable
  • Which "advanced" types can be a member?
  • Declaring variables with the same name
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
A composite variable contains different types of elements (members).
Remark: If you manipulate custom variables, it is advisable to declare:
  • a composite variable if a single variable of this type is used in your project (to pass parameters to an API for example).
  • a structure type if several variables of this type are used in different processes of the project.
Ejemplo
ProductRef is composed of
	SCode is int
	PdtCode is fixed string of 10
END
ProductRef.SCode = 7
ProductRef.PdtCode = "Screen"
Sintaxis

Declaring a composite variable Ocultar los detalles

<Variable name> is composed of
   <Members of the composite variable>
END
<Variable name>:
Name of the composite variable to declare.
<Structure members>:
Declarations of the variables found in the composite variable. These variables are called members of the composite variable.
<END>:
End of declaration of the composite variable.

Handling a member of a composite variable Ocultar los detalles

<Variable name>.<Member name>
<Variable name>:
Name of the structure variable to declare.
<Member name>:
Name of the member to use.
Observaciones

Handling a composite variable

There is no need to reference the members of composite variable.
For example:
CompositeVar is composed of
	Member1 is fixed string of 8
	Member2 is fixed string of 12
END
Str = CompositeVar // Str is built by concatenating all the members
				// of the composite variable
CompositeVar = Str // Str is transferred to the composite variable

Type of the members in a composite variable

The members of a composite variable can have the following types:
Any other type of data (composite variable, constant, ...) is forbidden.

Declaring an array member in a structure

  • Declaring a member whose type is simple array:
    The array dimensions are fixed when the array is declared. The array dimensions can be modified by Dimension
  • Declaring a member whose type is dynamic array:
    The array dimensions must be defined (which means that the array must be allocated) before using the array.
For example:
// Declare a composite variable
MyCompVar is composed of
x1 is int
x2 is dynamic array       // Declare the array
END

// Allocate the array
MyCompVar.x2 = new dynamic array of 4,7 int
// Initialize the array
MyCompVar.x2[1,1] = 25

Limits of a composite variable

You cannot:
  • directly assign a composite variable to another composite variable: each member must be assigned one by one.
  • compare two composite variables.
  • pass a composite variable as parameter to a procedure.
  • define an inheritance in a composite variable.
  • restrict the access to a member of a composite variable: all the members of a composite variable must be public.

Which "advanced" types can be a member?

An "advanced" variable can be a member of another "advanced" variable. The table below presents the different combinations:
Composite variableStructureClassArray
Composite variableNoNoNoNo
StructureYesYesYesYes
ClassYesYesYesYes
ArrayYesYesYesNo

Declaring variables with the same name

You cannot declare:
  • two variables with the same name (regardless the type of these variables) in a process.
  • two members with the same name in the same composite variable.
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 30/09/2024

Señalar un error o enviar una sugerencia | Ayuda local