....Contnd from part 1
1. SORTING:
you can sort the data so as to display data in ascending or descending order as below using keyword $orderby
https://********devaos.cloudax.dynamics.com/data/Beaconservice?$orderby=BeaconNum desc
and the result will look like as below. However, for sorting multiple fields can be used as
https://********devaos.cloudax.dynamics.com/data/Beaconservice?$orderby=BeaconNum desc,OfferId asc
2. FILTER(Get selective records):
You can filter out the records based on selection criteria to get relevant data. keyword would be $filter
https://********devaos.cloudax.dynamics.com/data/Beaconservice?$filter=BeaconNum eq '345678912'
If provided field is of type Int, then you don't have to use singe quotes(').
However, there is a trick if you want to use a filter on Enum field. you need to have a AOT name of an used enum. In my case AOT name of an enum is BeaconStatus with values "Active","Inactive" and "Locked".
enum field is "BeaconStatus".
After fieldname, value have to be passed using "Microsoft.Dynamics.DataEntities" as below.
If you have read my previous post, full metadata provides us the type to use. In our case it was "Microsoft.Dynamics.DataEntities.BeaconStatus"
I have to filter out the records where BeaconStatus is 'InActive'.
https://********devaos.cloudax.dynamics.com/data/Beaconservice?$filter=BeaconStatus eq Microsoft.Dynamics.DataEntities.BeaconStatus'InActive'
To Filter out records based on the date or datetime field, you need to provide it in Json standards as 2017-01-08T12:00:00Z https://*********devaos.cloudax.dynamics.com/data/Beaconservice?$filter=EffectiveDate eq 2017-05-08T12:00:00Z
Output will be as below
3. SELECTED FIELDS:
You might face a scenario where you don't need all fields to be displayed. for that you can use $select
https://*********devaos.cloudax.dynamics.com/data/Beaconservice?$select=BeaconNum,Description,OfferId
Result will look like
There might be scenarios where you might want to get only few top records. $top keyword can be used for this purpose as below
https://*********devaos.cloudax.dynamics.com/data/Beaconservice?$top=1
5. Skip some records from result(SKIP)
If you want to skip some records for selection using $skip
https://**********devaos.cloudax.dynamics.com/data/Beaconservice?$skip=2
6.COUNT
https://*******devaos.cloudax.dynamics.com/data/Beaconservice/$count
Will be discussing about use of logical operators with Data entities on my Next blog on READ operations.
1. SORTING:
you can sort the data so as to display data in ascending or descending order as below using keyword $orderby
https://********devaos.cloudax.dynamics.com/data/Beaconservice?$orderby=BeaconNum desc
and the result will look like as below. However, for sorting multiple fields can be used as
https://********devaos.cloudax.dynamics.com/data/Beaconservice?$orderby=BeaconNum desc,OfferId asc
{ "@odata.context": "https://*****devaos.cloudax.dynamics.com/data/$metadata#Beaconservice", "value": [ { "@odata.etag": "W/\"JzEsNTYzNzE0NDU3OCc=\"", "Description": "Beacon 3", "dataAreaId": "usrt", "BeaconNum": "345678912", "EffectiveDate": "2017-05-08T12:00:00Z", "BeaconStatus": "Active", "Brand": "Brand3", "StartTime": 0, "Category": "Category3", "EndTime": 0, "Offer": "", "OfferId": "Offer3" }, { "@odata.etag": "W/\"Jzg0ODAyMzczOCw1NjM3MTQ0NTc3Jw==\"", "Description": "Beacon 2", "dataAreaId": "usrt", "BeaconNum": "234567891", "EffectiveDate": "2017-01-08T12:00:00Z", "BeaconStatus": "InActive", "Brand": "Brand2", "StartTime": 0, "Category": "Category2", "EndTime": 0, "Offer": "", "OfferId": "offer2" }, { "@odata.etag": "W/\"JzE0NTk5MjkxNjcsNTYzNzE0NDU3Nic=\"", "Description": "beacon 1", "dataAreaId": "usrt", "BeaconNum": "123456789", "EffectiveDate": "2017-01-08T12:00:00Z", "BeaconStatus": "Active", "Brand": "Brand1", "StartTime": 0, "Category": "Category1", "EndTime": 0, "Offer": "", "OfferId": "Offer1" } ] }
2. FILTER(Get selective records):
You can filter out the records based on selection criteria to get relevant data. keyword would be $filter
https://********devaos.cloudax.dynamics.com/data/Beaconservice?$filter=BeaconNum eq '345678912'
{ "@odata.context": "https://********devaos.cloudax.dynamics.com/data/$metadata#Beaconservice", "value": [ { "@odata.etag": "W/\"JzEsNTYzNzE0NDU3OCc=\"", "Description": "Beacon 3", "dataAreaId": "usrt", "BeaconNum": "345678912", "EffectiveDate": "2017-05-08T12:00:00Z", "BeaconStatus": "Active", "Brand": "Brand3", "StartTime": 0, "Category": "Category3", "EndTime": 0, "Offer": "", "OfferId": "Offer3" } ] }
If provided field is of type Int, then you don't have to use singe quotes(').
However, there is a trick if you want to use a filter on Enum field. you need to have a AOT name of an used enum. In my case AOT name of an enum is BeaconStatus with values "Active","Inactive" and "Locked".
enum field is "BeaconStatus".
After fieldname, value have to be passed using "Microsoft.Dynamics.DataEntities" as below.
If you have read my previous post, full metadata provides us the type to use. In our case it was "Microsoft.Dynamics.DataEntities.BeaconStatus"
I have to filter out the records where BeaconStatus is 'InActive'.
https://********devaos.cloudax.dynamics.com/data/Beaconservice?$filter=BeaconStatus eq Microsoft.Dynamics.DataEntities.BeaconStatus'InActive'
{ "@odata.context": "https://*********devaos.cloudax.dynamics.com/data/$metadata#Beaconservice", "value": [ { "@odata.etag": "W/\"Jzg0ODAyMzczOCw1NjM3MTQ0NTc3Jw==\"", "Description": "Beacon 2", "dataAreaId": "usrt", "BeaconNum": "234567891", "EffectiveDate": "2017-01-08T12:00:00Z", "BeaconStatus": "InActive", "Brand": "Brand2", "StartTime": 0, "Category": "Category2", "EndTime": 0, "Offer": "", "OfferId": "offer2" } ] }
To Filter out records based on the date or datetime field, you need to provide it in Json standards as 2017-01-08T12:00:00Z https://*********devaos.cloudax.dynamics.com/data/Beaconservice?$filter=EffectiveDate eq 2017-05-08T12:00:00Z
Output will be as below
{ "@odata.context":"https://********devaos.cloudax.dynamics.com/data/$metadata#Beaconservice", "value":[ { "@odata.etag":"W/\"JzEsNTYzNzE0NDU3OCc=\"", "Description":"Beacon 3", "dataAreaId":"usrt", "BeaconNum":"345678912", "EffectiveDate":"2017-05-08T12:00:00Z", "BeaconStatus":"Active", "Brand":"Brand3", "StartTime":0,"Category": "Category3","EndTime":0, "Offer":"", "OfferId":"Offer3" } ] }
3. SELECTED FIELDS:
You might face a scenario where you don't need all fields to be displayed. for that you can use $select
https://*********devaos.cloudax.dynamics.com/data/Beaconservice?$select=BeaconNum,Description,OfferId
Result will look like
{ "@odata.context": "https://******devaos.cloudax.dynamics.com/data/$metadata#Beaconservice(BeaconNum,Description,OfferId)", "value": [ { "@odata.etag": "W/\"JzE0NTk5MjkxNjcsNTYzNzE0NDU3Nic=\"", "BeaconNum": "123456789", "Description": "beacon 1", "OfferId": "Offer1" }, { "@odata.etag": "W/\"Jzg0ODAyMzczOCw1NjM3MTQ0NTc3Jw==\"", "BeaconNum": "234567891", "Description": "Beacon 2", "OfferId": "offer2" }, { "@odata.etag": "W/\"JzEsNTYzNzE0NDU3OCc=\"", "BeaconNum": "345678912", "Description": "Beacon 3", "OfferId": "Offer3" } ] }4.Get selective number of records(TOP):
There might be scenarios where you might want to get only few top records. $top keyword can be used for this purpose as below
https://*********devaos.cloudax.dynamics.com/data/Beaconservice?$top=1
{ "@odata.context": "https://********devaos.cloudax.dynamics.com/data/$metadata#Beaconservice", "value": [ { "@odata.etag": "W/\"JzE0NTk5MjkxNjcsNTYzNzE0NDU3Nic=\"", "Description": "beacon 1", "dataAreaId": "usrt", "BeaconNum": "123456789", "EffectiveDate": "2017-01-08T12:00:00Z", "BeaconStatus": "Active", "Brand": "Brand1", "StartTime": 0, "Category": "Category1", "EndTime": 0, "Offer": "", "OfferId": "Offer1" } ] }
5. Skip some records from result(SKIP)
If you want to skip some records for selection using $skip
https://**********devaos.cloudax.dynamics.com/data/Beaconservice?$skip=2
{ "@odata.context": "https://*********devaos.cloudax.dynamics.com/data/$metadata#Beaconservice", "value": [ { "@odata.etag": "W/\"JzEsNTYzNzE0NDU3OCc=\"", "Description": "Beacon 3", "dataAreaId": "usrt", "BeaconNum": "345678912", "EffectiveDate": "2017-05-08T12:00:00Z", "BeaconStatus": "Active", "Brand": "Brand3", "StartTime": 0, "Category": "Category3", "EndTime": 0, "Offer": "", "OfferId": "Offer3" } ] }
6.COUNT
https://*******devaos.cloudax.dynamics.com/data/Beaconservice/$count
3
Will be discussing about use of logical operators with Data entities on my Next blog on READ operations.
Hello there! I've enjoyed reading through your blog posts. Your insights are both informative and engaging. It's refreshing to come across a blog that covers such a diverse range of topics. Keep up the great work, and I'm looking forward to reading more from you in the future!
ReplyDeleteMicrosoft Payroll Solutions Abu Dhabi
hr and payroll management dubai
Ms Crm Dubai
dynamics crm uae
microsoft dynamics finance and operations dubai
dynamics 365 sales professional uae
Business Central In Uae
microsoft power platform partner uae
cyber security company in uae
dynamics 365 payroll in uae
eXperts People 365
microsoft dynamics 365 property management
implementation partners in dubai
Business Process Consulting
digital transformation consulting services dubai
Digital Transformation Consultancy uae
Thanks sharing the blog on Best Data Operations Agency
ReplyDeleteHas anyone here used Dynamics Stream for their Microsoft Dynamics 365 implementation? I'm looking for a partner in the UK to help us get set up and wondering about experiences with them. They seem to offer the full range of services (implementation, migration, customization) which is appealing, but it would be great to hear from others who have worked with them.
ReplyDelete