Structs/Variants Data Conversion

Version 5

ATEasy allows complex data conversion between structures and Variants through assignment; namely, you can assign a structure to a variant and vice versa.

First you can assign a structure to a variant.  Then assign the variant back to a structure of same type. Internally the structure is converted to an array of variants, each variant element being each corresponding structure field. For further detailed information see Assigning Structs to Structs or to Variants.

Example

In the following example, we have an array of variants.  The first variant element is set to a structure, stUsersTag.  Then to users.Tag we assign the array.

avInfo[0]=stUsersTag        ! assigning Structure to Variant
users.Tag=avInfo

To retrieve the info,

avInfo=users.Tag
stUsersTag=avrInfo[0]        ! assigning Variant back to Structure

Comment

This conversion is useful for storing struct information into a variant.  ATEasy implementation of this conversion allows you to modify (add or delete) the structure without error as long as they are appended/deleted at the end of the structure definition.