ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / How to proceed? / Programming
  • Declaring a structure
  • Using a structure
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
How to create and handle a structure?
A structure is a type of variable made of other variables.
For example, an "Address" variable can be made of:
  • Name of my company
  • Name of contact
  • Address
  • Zip code
  • City
  • Country
This allows you to pass as parameter to a procedure a variable created from a structure instead of passing as many parametes as the number of elements found in the structure.
Declaring a structure
To declare a structure, use the following syntax:
StructureName is structure
Member1 is <type of variable>
Member2 is <type of variable>
...
END
For example:
stAddress is Structure
CompanyName is string
ContactName is string
Address is string
PostalCode is string
City is string
Country is string
END
Using a structure
To use an existing structure, you must:
  1. Declare a variable (same type as the structure).
  2. Initialize the members taking part in the structure.
For example:
stAddress is Structure
CompanyName is string
ContactName is string
Address is string
PostalCode is string
City is string
Country is string
END
 
ACustomer is stAddress
 
ACustomer.CompanyName = "PC SOFT"
ACustomer.ContactName = "Paul Doe"
ACustomer.Address = "3 Rue Puech Villa"
ACustomer.ZipCode = "34000"
ACustomer.City = "Montpellier"
ACustomer.Country = "FRANCE"
Remarks
The structures can be declared:
  • in the project code (structure global to the entire project).
  • in the code of a window or page (structure global to the window or page).
  • in any process (structure local to the process).
For more details, see The Structure variables.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 10/27/2022

Send a report | Local help