SmartConnector Forum
Schneider Electric support forum about SmartConnector applications for integration of other building management systems (BMS) into EcoStruxure Building Operation.
Link copied. Please paste this link to share this article on your social media post.
Hi,
Assuming my language in the OS Regional settings is Danish, and the decimal point is a comma (","), will SmartConnector send EBO values to its SmartConnetcor clients using the comma or the "." decimal point?
For example, will it send "11,3" as the value is seen in the EBO? Or, "11.3"?
If it is always using the "." decimal point can you release a new version that considers the language in the regional settings?
Thank you.
Michael
Link copied. Please paste this link to share this article on your social media post.
Hi,
Where is your error occurring? In your code or EBO? Smartconnector (and as far as I know EBO in its EWS implementation) uses InvariantCulture. It will be using . as separator.
BR
Armend
Link copied. Please paste this link to share this article on your social media post.
Hi Armend,
The error is in our code. We use a Windows API to convert a string value to double. When the regional settings are Danish, the conversion from "11.3" to double will be 113 instead of 11.3 since "11.3" is not a valid number. It should be "11,3".
Changing the Regional Format to Danish also changes the default Decimal Symbol used by the OS from period to comma. Therefore, the string value containing a period does not get recognized.
The workaround we used is to convert the string "11.3" to "11,3" before we convert it to double. It is now working well but it would be nice if the SmartConnector will support the regional settings including the decimal point as comma.
Thank you.
Mike
Link copied. Please paste this link to share this article on your social media post.
As I've said, EBO and Smartconnector will always use the . as a separator. It doesn't make sense to make smartconnector culture sensitive as it would introduce unnecessary problems where systems with different culture settings can't be connected.
You can read more about culture insensitive code here.
Use this:
string ewsValue = "11.3";
var converted = Convert.ToDouble(ewsValue, CultureInfo.InvariantCulture);
BR
Armend
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.