In this video, I show some of the tricks that the Variant Data Type offer, and why they’re still useful today, check it out:
Tag Archives: Variant
NAV Design Pattern: Variant Façade
The Variant façade provides a single interface that can take any Record, RecordRef or RecordID as an argument. With this pattern, the code is encapsulated within the single object, with clear separation between common and table specific code.
Passing Records and RecordRefs via Variants
As developers in an ever more repeatable world we should strive to write code in ways that make it as flexible and generic as we possibly can. A trick I use is too pass things around in ever more generic ways by using Variants.
A good example can be seen below where the function ReturnRecordIDasText function takes either a Record or a RecordRef as input and then returns the RECORDID as text.
The power of Variants
This blogpost of Arend Jan Kauffman reminded me of a topic that I wanted to write a very long time now. Namely working with Variants. Sometimes I get the remark: “what the hell are they useful for? “. And to be honest: Variants could be bloody useful in some cases. Cases to make stuff even more generic then only working with RecordRef, FieldRef and such. The keyword is “Generic” here.