Big thank you to all who helped me with learning how to create a custom class. I had some trouble in the instantiation during runtime vs instantiation via IDE area but I solved all the issues.
I need to make a strategic decision, and I would like some advice.
I am creating a class LabWorkParameter. This class will have the following properties
LabParam.Name as String
LabParam.Abbreviation as String
LabParam.Value as … (?)
LabParam.ReferenceRange as String
LabParam.Units as String
I need to make a decision of what kind of variable would be the Value parameter. Some of the lab work results are doubles such as potassium (4.2 mmol/L) while others are strings such as blood culture result could be “Staph. Aureus.”
Should I use Variant instead of Double and String?
make clsValue (I would call it Results myself, but that is your cal) class and declare Value as the class. The clsValus class would contain a stringValue, a DoubleValue etc.
Make Value a Variant. It will accept pretty much any kind of data.
The value property could even be an array to store many different results for one lab request, regardless of the option you choose. (I know that my blood tests are a long list and many tubes!)
I’ve made a lab work app, and all results are stored as a string. works nice like that.
because sometimes you need a result like “<0.05” and you can’t store it in a variant.
the units are stored as string in another field like you do.
You need to know what you will do with such value later. Probably just a string is enough, but you must guarantee the integrity of the value, and if using the value for something other then presentation (like calculations) probably you will need a property that makes you know this condition for proper handling/conversions (including, maybe, number of decimals digits to store). Or even having a shadow equivalent Double property storing its full calculated value. Many options.
Changing the position of the slider I was able to change the Potassium value and it was displayed as a decimal fraction with two digits after the decimal point.
The following code did not produce a decimal fraction for the Potassium value
look into the format function (which turns a number into a formatted string)… but Scientific Notation happens with Double values once the exceed certain parameters