Dynamics 365创建记录-小数位数精度 [英] Dynamics 365 Create a Record - Decimal Number Precision

查看:190
本文介绍了Dynamics 365创建记录-小数位数精度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部

我正在尝试使用OOTB连接器在Dynamics 365中创建一条记录.我在Dyn65中有一个十进制数字字段,精度为10.

I am trying to create a record in Dynamics 365 using the OOTB connector. I have a decimal number field in Dyn65 with a precision of 10.

在逻辑应用程序中,如果我输入0或0.000002或更高的值,它将起作用.但是,如果输入值0.000001,则会出现以下错误:

In logic apps, if I enter the value of 0 or 0.000002 and above, it works. However, if I enter the value of 0.000001 I get the following error:

{
  "status": 400,
  "message": "An error occurred while validating input parameters: Microsoft.OData.ODataException: Cannot convert the literal '1E-06' to the expected type 'Edm.Decimal'. ---> System.FormatException: Input string was not in a correct format.\r\n   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)\r\n   at System.Number.ParseDecimal(String value, NumberStyles options, NumberFormatInfo numfmt)\r\n   at System.Convert.ToDecimal(String value, IFormatProvider provider)\r\n   at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)\r\n   at Microsoft.OData.ODataPayloadValueConverter.ConvertStringValue(String stringValue, Type targetType)\r\n   at Microsoft.OData.ODataPayloadValueConverter.ConvertFromPayloadValue(Object value, IEdmTypeReference edmTypeReference)\r\n   --- End of inner exception stack trace ---\r\n   at Microsoft.OData.ODataPayloadValueConverter.ConvertFromPayloadValue(Object value, IEdmTypeReference edmTypeReference)\r\n   at Microsoft.OData.JsonLight.ODataJsonLightReaderUtils.ConvertValue(Object value, IEdmPrimitiveTypeReference primitiveTypeReference, ODataMessageReaderSettings messageReaderSettings, Boolean validateNullValue, String propertyName, ODataPayloadValueConverter converter)\r\n   at Microsoft.OData.JsonLight.ODataJsonLightPropertyAndValueDeserializer.ReadPrimitiveValue(Boolean insideJsonObjectValue, IEdmPrimitiveTypeReference expectedValueTypeReference, Boolean validateNullValue, String propertyName)\r\n   at Microsoft.OData.JsonLight.ODataJsonLightPropertyAndValueDeserializer.ReadNonEntityValueImplementation(String payloadTypeName, IEdmTypeReference expectedTypeReference, PropertyAndAnnotationCollector propertyAndAnnotationCollector, CollectionWithoutExpectedTypeValidator collectionValidator, Boolean validateNullValue, Boolean isTopLevelPropertyValue, Boolean insideComplexValue, String propertyName, Nullable`1 isDynamicProperty)\r\n   at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadEntryDataProperty(IODataJsonLightReaderResourceState resourceState, IEdmProperty edmProperty, String propertyTypeName)\r\n   at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadPropertyWithValue(IODataJsonLightReaderResourceState resourceState, String propertyName)\r\n   at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.<>c__DisplayClass4_0.<ReadResourceContent>b__0(PropertyParsingResult propertyParsingResult, String propertyName)\r\n   at Microsoft.OData.JsonLight.ODataJsonLightDeserializer.ProcessProperty(PropertyAndAnnotationCollector propertyAndAnnotationCollector, Func`2 readPropertyAnnotationValue, Action`2 handleProperty)\r\n   at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadResourceContent(IODataJsonLightReaderResourceState resourceState)\r\n   at Microsoft.OData.JsonLight.ODataJsonLightReader.ReadAtNestedResourceInfoEndImplementationSynchronously()\r\n   at Microsoft.OData.ODataReaderCore.ReadImplementation()\r\n   at Microsoft.OData.ODataReaderCore.InterceptException[T](Func`1 action)\r\n   at System.Web.OData.Formatter.Deserialization.ODataReaderExtensions.ReadResourceOrResourceSet(ODataReader reader)\r\n   at System.Web.OData.Formatter.Deserialization.ODataResourceDeserializer.Read(ODataMessageReader messageReader, Type type, ODataDeserializerContext readContext)\r\n   at System.Web.OData.Formatter.ODataMediaTypeFormatter.ReadFromStream(Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger)",
  "source": "xxxxxx.crm11.dynamics.com",
  "errors": [],
  "debugInfo": "clientRequestId: d99efd9e-32f8-403b-ab27-6a4f85883c1f"
}

不幸的是,当我从API调用中获得结果时,我需要满足该值.有人发现了这个/有没有解决的办法?

Unfortunately as I get the result from an API call, I need to cater for the value. Anybody spotted this/have a work around?

推荐答案

嗨乔什,

因此,如果我正确理解,两个值(0.000000002和0.000000001)具有相同的精度,并且一个值大于另一个精度,但是对于较小的值,Dynamics 365 REST API上却发生验证错误吗?如果是这样,您是否正在寻找有关Dynamics的解决方案 365社区?

我不确定在洛杉矶有什么办法可以解决此问题,除非您能够更改您的要求(即:有条件断言并把0.000000001转换为纯0,这将通过此验证等).如果没有,则给出验证要求 是由Dynamics 365 REST API强制实施的,而LA连接器实际上是围绕该REST API及其操作的包装,我想向Dynamics团队咨询此问题.

So if i understood correctly, both values (0.000000002 and 0.000000001) are of same precision, and one is greater than the other, yet validation error is occurring on Dynamics 365 REST API for the lesser value? If so, have you looked for solutions on Dynamics 365 community?

I'm not sure how much we can do in LA to workaround this unless you're able to change your requirement (i.e: conditional for asserting & turning 0.000000001 into a plain 0 which will pass this validation etc..). If not, given the validation requirement is being imposed from Dynamics 365 REST API and the LA connector being really a wrapper around this REST API and its operations, I'd inquire about this issue with the Dynamics team.


这篇关于Dynamics 365创建记录-小数位数精度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆