You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I haven't used C# prior but I have found my way through stack overflow to check for numeric types and converted them to double.
Changed the PIDataRetrievalAsync.cs
Object val;
val = values[i].Value;
if (IsNumericType.IsNumeric(val.GetType()))
val = values[i].ValueAsDouble();
outputStreamWriter.WriteLine($"{values[i].Timestamp.UtcTime.ToString("o")},{val}");
And added the following class in the same file,
public static class IsNumericType
{
public static bool IsNumeric(this Type type)
{
switch (Type.GetTypeCode(type))
{
case TypeCode.Byte:
case TypeCode.SByte:
case TypeCode.UInt16:
case TypeCode.UInt32:
case TypeCode.UInt64:
case TypeCode.Int16:
case TypeCode.Int32:
case TypeCode.Int64:
case TypeCode.Decimal:
case TypeCode.Double:
case TypeCode.Single:
return true;
case TypeCode.Object:
if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))
{
return Nullable.GetUnderlyingType(type).IsNumeric();
//return IsNumeric(Nullable.GetUnderlyingType(type));
}
return false;
default:
return false;
}
}
}
The number values are formatted in scientific notation and lose precision.
The text was updated successfully, but these errors were encountered: