Thursday, January 23, 2025

How to apply like operator, order by in D365 Odata URL.

  How to apply like operator, orderby in D365 Odata URL.

like operator in D365 Odata URL.


1. While fetching data from D365, we can apply filters.

2. In some cases, we may need to use a "like" operator.

3. To achieve this, we need to include a * in the text.

{{resource}}/data/VendorGroups?Cross-company=true&$filter=Description eq '*Test*'

4. I have tested this with three scenarios, as listed below:

  •     '*     ' -->   Prefix 
  •     '     *' -->   Suffix
  •     '*   *' --> Prefix and Suffix


With Select:

{{resource}}/data/VendorGroups?Cross-company=true&$select=VendorGroupId,DefaultPaymentTermName,Description
        &$filter=Description eq '*Test*'

Order by operator in D365 Odata URL.

1. We can apply order by for more than one field.
{{resource}}/data/VendorGroups?Cross-company=true&$orderby=dataAreaId,VendorGroupId


With Select:
{{resource}}/data/VendorGroups?Cross-company=true&$select=dataAreaId,VendorGroupId,DefaultPaymentTermName,Description
    &$orderby=dataAreaId,VendorGroupId

2. Applied order by for VendGroupId field.




MS ODATA URL

    Keep daxing!!

No comments:

Post a Comment