Dynamics CRM通过API提取时删除重复的数据 [英] Dynamics crm remove the repeated data while fetching via api
本文介绍了Dynamics CRM通过API提取时删除重复的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试检索一个特定国家/地区下的所有州.
Trying to retrieve all state under one particular country.
URL:
api/data/v9.1/leadaddresses?$select=stateorprovince&$filter=stateorprovince ne null and country eq 'US'&$count=true&$orderby=stateorprovince
这里的问题是它会返回这样的数据
Problem here is it returns data like this
"value": [
{
"@odata.etag": "W/"166729382"",
"stateorprovince": "AK",
"leadaddressid": "691de670-aa45-426b-8fee-00b3a7f7e469"
},
{
"@odata.etag": "W/"166729369"",
"stateorprovince": "AK",
"leadaddressid": "12db5897-dc53-44ae-b4aa-03c5486ad6ac"
},
{
"@odata.etag": "W/"166729416"",
"stateorprovince": "AK",
"leadaddressid": "f64ccf06-fa67-421a-aa5f-0469302be1c2"
},
{
"@odata.etag": "W/"166729206"",
"stateorprovince": "AK",
"leadaddressid": "b1f9ce4a-a06b-4d7d-befc-04bea0d41a4e"
},
{
"@odata.etag": "W/"166729323"",
"stateorprovince": "AK",
"leadaddressid": "a4b9ff56-2d24-4957-b09b-04ef6ce56304"
},
任何删除重复数据的方法.
Any way to remove the repeated data.
推荐答案
您必须使用fetchxml来获取不同的值,这是唯一的选择.
You have to use fetchxml to get distinct values, that is the only option.
<fetch top="50" distinct="true" >
<entity name="leadaddress" >
<attribute name="stateorprovince" />
<filter type="and" >
<condition attribute="stateorprovince" operator="not-null" />
</filter>
</entity>
</fetch>
您可以使用Web api端点并使用上述fetchxml,如下所示:
You can use web api endpoint and use the above fetchxml like below:
https://crmdev.crm.dynamics.com/api/data/v9.1/leadaddresses?fetchXml=<fetch top="50" distinct="true" > <entity name="leadaddress" > <attribute name="stateorprovince" /> <filter type="and" > <condition attribute="stateorprovince" operator="not-null" /> </filter> </entity> </fetch>
这篇关于Dynamics CRM通过API提取时删除重复的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文