rest - Odata. Filter for some string field not working
问题描述
Im using Odata v3 with 1C Enterprise 8.3.10. on Apache Tomcat 2.2.
This query
http://localhost/TEST/odata/standard.odata/AccountingRegister_Типовой/Balance()?$top=1
returns such result:
<d:Result xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:type="Collection(StandardODATA.AccountingRegister_Типовой_Balance)">
<d:element m:type="StandardODATA.AccountingRegister_Типовой_Balance">
<d:Account_Key>8064bbd7-6b39-11e1-978d-00265502bde5</d:Account_Key>
<d:ExtDimension1>3e0969a1-6b39-11e1-978d-00265502bde5</d:ExtDimension1>
<d:ExtDimension1_Type>StandardODATA.Catalog_ОсновныеСредства</d:ExtDimension1_Type>
...
</d:element>
</d:Result>
when I try adding filter http://localhost/TEST/odata/standard.odata/AccountingRegister_Типовой/Balance()?$top=1&$filter=ExtDimension1 eq '3e0969a1-6b39-11e1-978d-00265502bde5'
It returns empty result.
The type of 'ExtDimension1' field is Edm.String, not guid
(from $metadata)
<ComplexType Name="AccountingRegister_Типовой_Balance">
<Property Name="Account_Key" Type="Edm.Guid" Nullable="true"/>
<Property Name="ExtDimension1" Type="Edm.String" Nullable="true"/>
<Property Name="ExtDimension1_Type" Type="Edm.String" Nullable="true"/>
...
I also tried to filter like this:
$filter=ExtDimension1 eq guid'3e0969a1-6b39-11e1-978d-00265502bde5'
but it returns an error.
If I filter by another field
(for example ExtDimension1_Type) it works correctly.
Does anybody know how to filter by 'ExtDimension1' field?
UPDATE
Here is description of Balance() function from metadata. Hope it will be usefull
<FunctionImport Name="Balance" IsBindable="true" IsSideEffecting="false" ReturnType="Collection(StandardODATA.AccountingRegister_Типовой_Balance)">
<Parameter Name="bindingParameter" Type="StandardODATA.AccountingRegister_Типовой"/>
<Parameter Name="AccountCondition" Type="Edm.String"/>
<Parameter Name="Condition" Type="Edm.String"/>
<Parameter Name="Dimensions" Type="Edm.String"/>
<Parameter Name="ExtraDimensions" Type="Edm.String"/>
<Parameter Name="Period" Type="Edm.DateTime"/>
</FunctionImport>
解决方案
我有一个类似的问题,我找到了解决方案。
$filter=ExtDimension1 eq cast('3e0969a1-6b39-11e1-978d-00265502bde5', 'Catalog_ОсновныеСредства')
推荐阅读
- php - 创建没有 eval 的动态 if 语句
- twilio - 如何使用 Twilio 号码在 Zoiper 中发送/接收短信?
- c# - 如何访问模板生成的元素 wpf
- javascript - 为什么我制作的这个命令历史不起作用?
- javascript - jQuery 文件已保存但在浏览器中未更改
- azure-devops - 如何在 Azure DevOps 分析中为 Sprint 和董事会计算特定指标
- java - 如何使用一个表中的数据作为参考来使用 Firebase 获取另一个表中的另一个数据?
- python - 如何在链接验证后重定向用户以在 aws cognito 中拥有自定义 UI?
- scala - 在 k 折验证中的每次迭代/折中获取单个模型分数
- vue.js - 具有本地数据源(客户端)的vue js中剑道网格中的分页