This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Variant values in M-files and localisation errors in number calculations

Dear all,

I have run into a problem that I hope you might be able to give some insight into.

I have a problem of where localised information in the M-files server was previously set to have the ',' (Comma) character as the decimal indicator but now it moved to '.' full stop.

This caused some calculations to add two zero's to each calculation where something was multiplied with a double. My problem now is with the DisplayValue property when retrieving the value from the server (vbscript) :

Ex. PropertyValues.SearchForProperty(1234).TypedValue.DisplayValue

In order to resolve this I am considering changing the DisplayValue to the Value function to ensure that the decimals would be understood in the current server context (independent from locale/regional settings). 

My problem is when trying to cast the Variant dataType it does not relate to any known vbDataTypes. When I ask for the datatype is outputs datatype 8204:

VarType(PropertyValues.SearchForProperty(39).TypedValue.Value)

The above is for the state property which I understand should be text (vbString (8): String)

Can anyone please help me to understand if it is possible to convert from Value : variant type to string / integer / double, or otherwise any good ideas to get past the , and . regional problem with double value calculations ?

Regards and thanking you for your help.

Parents Reply Children
No Data