To create a schema variant you call SchemaVariantCreate followed by a call to set some data into it with the appropriate function. Until you have set data into the newly created schema variant the type of the schema variant will be SystemType::Undefined. Calling schema variant functions on undefined schema variants may fail.
When you are finished with a schema variant call SchemaVariantDelete to free the schema variant.
Example
Setting/Changing
You can set/change the value and type of a schema variant with the following calls
Sometimes the schema framework may need to call functions for a schema variant in order to perform operations like casts. This may require the schema framework to know what class the schema variant belongs to. If you will need to perform class based operations on your schema variants then you should set a schema class for the schema variant by calling SchemaVariantSetSchema
Coercion
Coercion of schema variants is the act of forcing a schema variant to another type. The schema variant set functions (SchemaVariantSetBool etc) perform a coercion to the requested type before setting the value. The rules for coercion are as follows.
If the requested type is the same as the schema variant type then no change to the schema variant occurs
If the requested type is different to the schema variant type and the requested type is one of the standard types (Undefined, ANumber, AString or Boolean) then the type is changed and the value of the variant is set to the default for that type.
If the requested type is any other type the type of the schema variant is changed but the value is not