Hello i have a list in data service that i want to export into a excel sheet then clear the data service list. ANy idea on how to perfrom this ?
Hi @langsem, you can accomplish this via a process that uses the Data Service activities.
To export data to an excel sheet, you will need to:
- Build a data table with the fields you’d like to capture from the entity
- Use the query entity records activity to get the list of records that you’d like to export from Data Service
Note: If you have more than 1000 records, you will need to implement logic for pagination
- For each record in this list, create a Data Row and add it to the Data Table created in step 1.
- Finally, write the Data Table to the Excel file using the Write Range activity
To delete records from an Entity in Data Service, you will need to:
- Use the query entity records activity to get the list of records that you’d like to delete from Data Service
- Iterate through the list of records and create a list of record ids (of type System.Guid) for the records that need to be deleted
- Use the delete multiple records activity to delete records
what do you mean in step 3 ? I cant assign the item in for each to the add data row action. Shouldent i use an assign activity for each element ?
@langsem - that’s right. For each record in the list, you will need to use the multiple assign activity to populate the data in the data row, and then add it to the data table.
Also here’s an example project that illustrates both download to Excel and Delete.
Download to Excel and Delete example.zip (22.9 KB)
This example saves the Name and Nations data from the Olympics entity from the example here: Using entities in projects
Made that one work, the issue now its to delete the data in data service. Its complaining about the data type System.Guid. But cant use it as System.Guid
Hi @langsem, the example project in my previous reply also includes an example of how to delete data from Data Service.
To delete data, you will need to iterate through each record in the list resulting from the query activity, and add the Id property of each item to a collection of type System.Guid. Finally, you can use the Delete Multiple Records activity and provide it this list of Guids to delete records.
Here’s a screenshot of the steps to delete records using the activity from the example project
Hello @Karan, the XAML that you uploaded here, shows some error(“The activity is missing”) after I downloaded it, can you help me with a new XAML.
Hi @Dimple_Mandal, have you imported the Data Service Activities Pack into our project?
If not, you can add it from Manage Packages → Official and searching for Data Service
Hey @Karan, thanks for the post! Can you elaborate on you Note in step 2. I have a data service entity with more than 1,000 rows. I can see that I’m only able to query up to 1000. Are you saying that I have to iterate through the Skip argument under the pagination properties?
Yes, that is the correct way to go about it. Skip the first 1,000 records after the first query, and so on and so forth.
Thank you for this, but even after Importing Data Service activities, It’s giving below error.
Tried installing all the Package versions available.
Currently Using Studio 2022.12.0 Community Edition
Have you tried importing the new 22.12.2-preview Data Service package? Unfortunately, the new version of Desktop 22.10 isn’t compatible with the previous data service package versions (21.10.0, 21.10.1, etc.). In order to continue to use data service activities you must either use the previous version of desktop or upgrade to the 22.12.2-preview data service package. Please note that this new package is a preview package and might have some instability. Thanks!