Dear Friends
Please guide me how I will fetch the DISTINCT records from Entity using WEB API
Kind Regards
Anil
*This post is locked for comments
Dear Friends
Please guide me how I will fetch the DISTINCT records from Entity using WEB API
Kind Regards
Anil
*This post is locked for comments
since XML is slow, it is hard to say where the breaking point is on just getting everything and creating a distinct list yourself. It would be much better to just have a $&Distinct='true' in the URL.
Hello Anil,
- Yes you can use group by attribute to get distinct records.
- Here we fetch contact with distinct lastname.
=> /api/data/v9.0/contacts?$apply=groupby((lastname,firstname))
- Also you can use fetchXml to get distinct record by using distinct='true'.
Hello,
Would a group by be suitable for you?
Group by with $apply: /api/data/v9.2/accounts?$apply=groupby((name,accountnumber))
Source : docs.oasis-open.org/.../odata-data-aggregation-ext-v4.0-cs01.html
It really needs to be possible to do this without XML. XML parsing is very slow. Does anyone know if a JSON is possible or a direct query instead? Not really understanding why a simple $distinct='true' isn't possible or something like that in a regular query.
are you using within the Portals through oData? is this Portals or CRM? did you tag "Portals" by mistake maybe? can you please untag?
Hi Anil,
Try this syntax
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<entity name="incident">
<attribute name="incidentid" />
<attribute name="title" />
<attribute name="customerid" />
<attribute name="statuscode" />
<attribute name="caseorigincode" />
<order attribute="title" descending="false" />
<filter type="and">
<condition attribute="ownerid" operator="eq-userid" />
<condition attribute="statecode" operator="eq" value="0" />
</filter>
</entity>
</fetch>
As far as I know, you can only do this by submitting the query as a Fetch and specifying distinct="true" in the FetchXML
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156