Okay. Voila! I think I have beat the CustomMem EncodeVar() and DecodeVar() functions into submission. That is to say, I'm submitting new versions here on the forum.
As you may know from my other posts on the subject the original Zabaware EncodeVar() and DecodeVar() functions didn't preserve the data type and returned everything as a string. This is no longer the case.
I've modified the EncodeVar() function to preserve the data type and store it along with the variable. The new DecodeVar() function extracts the original data type info and returns the variable in the original data type format.
No modifications are needed to the usage of EncodeVar() and DecodeVar() within your code, unless you've added work-arounds to eliminate type mismatch errors. Just substitute the new function definitions for the old ones in the hal4.uhp or hal5.uhp file towards the end. As always, back up your files!
I've done limited testing of the new functions with string, integer, long, single, double and boolean data types. I haven't tested them with dates, currency and a couple other rarely used types. Arrays are not, and can not, be supported in CustomMem.
Give the improved functions a try and post feedback here. As usual I've tried to be careful and accurate in my coding, but I'm only human (not like Hal). Good luck.
= vonsmith =