【问题标题】:Dynamics crm remove the repeated data while fetching via apiDynamics crm 在通过 api 获取时删除重复数据
【发布时间】:2020-06-08 09:39:07
【问题描述】:

试图检索一个特定国家/地区下的所有州。

网址:

api/data/v9.1/leadaddresses?$select=stateorprovince&$filter=stateorprovince ne  null and country eq 'US'&$count=true&$orderby=stateorprovince

这里的问题是它返回这样的数据

"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"
},

任何删除重复数据的方法。

【问题讨论】:

    标签: php dynamics-crm dynamics-crm-webapi


    【解决方案1】:

    您必须使用 fetchxml 来获取不同的值,这是唯一的选择。

    <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,如下所示:

    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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-11-25
      • 2016-03-11
      • 1970-01-01
      • 2020-11-04
      • 1970-01-01
      • 1970-01-01
      • 2023-03-12
      • 2023-03-28
      相关资源
      最近更新 更多