PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • 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
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
Composite variable
In french: Variable composée
A composite variable contains different types of elements (members).
Note: If you are handling custom variables, we advise you 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.
Versions 16 and later
Universal Windows 10 App This feature is available for the Windows Phone applications.
New in version 16
Universal Windows 10 App This feature is available for the Windows Phone applications.
Universal Windows 10 App This feature is available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This feature is available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This feature is available for the iPhone/iPad applications.
iPhone/iPad This feature is available for the iPhone/iPad applications.
Versions 18 and later
Universal Windows 10 App This feature is available in Windows Store apps mode.
New in version 18
Universal Windows 10 App This feature is available in Windows Store apps mode.
Universal Windows 10 App This feature is available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
New in version 21
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
Example
ProductRef is composed of
        SCode is int
        PdtCode is fixed string on 10
END
ProductRef.SCode = 7
ProductRef.PdtCode = "Screen"
Syntax

Declaring a composite variable Hide the details

<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 Hide the details

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

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 on 8
        Member2 is fixed string on 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:
  • assign a composite variable to another composite variable directly: each member must be assigned individually.
  • compare two composite variables.
  • pass a composite variable in parameter to a procedure.
  • define an inheritance in a composite variable.
  • restrict the access to a member of a composite variable: all 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.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment