What is Choice set?
A Choice Set field is used to store an enumerated list from which one or more values can be selected. A Choice Set can be used, for example, to select an expense type, a forum post category, or a certain edition of a recurring event.
A Choice Set consists of choice values that can be selected from for a field based on that choice set. The Choice Set is also made available in Studio as
Accessing the Choice Sets
On the Data Service page, click the More options menu in the upper right corner.
Select Choice Sets. The Choice Sets page is displayed.
Creating Choice Sets
On the Choice Sets page, click Add Choice Set. The Create Choice Set panel is displayed.
In the Display Name field enter a display name for the Choice Set.
Click Add Choice.
Enter a name in the new choice display name field.
Repeat steps 3 and 4 for the other choices you want to add to the Choice Set.
Click More details to display an additional Description field. If needed, enter a description to indicate the function of the Choice Set.
The new Choice Set is displayed in the Choice Sets list.
I have created a TechnologyCategory Choice Set and these are the choices which added in the Choice Set.
Creating an Entity with a Choice Set Attribute in Data Services
On the Entities page, click on Create New Entity.
In the Display Name field enter a display name for the Entity. Lets say Technologies .
Double click on the Entity and create fields for this entity.
Click on Create New Field and in the Display Name field enter a display name for the field.
We will create 2 fields — “Title” & “Category”.The title field will be a simple text field.
6. Create the Category field and define it as a Choice Set.
- The Type is set to “Choice Set”
- Under Choice Set, the selection is set to “TechnologyCategory” — this is the Choice Set we created in the steps above!
- Make sure to enable the multiple-choice option as shown below.
7. Click Save to finish creating the Category Attribute.
Add data to the Technologies Entity
1.Click on the “Add Data” button and create the first sample record as shown below.
2. As Category field is a multiple-choice dropdown classify the technologies under two or more category labels.
3. We will create few sample records with as many different category labels as possible so that it becomes easier to verify the results from the Studio Project later.
4.Once you have completed creating the records, the Data screen must look like the one shown below.
Integration in UiPath Studio
First install the UiPath.DataServices.Activities package in your project.
2. In Manage Entities , select the entity which you want to import in your project and click on save button.
3. We will now use the Query Entity Records activity to retrive the records from Data services. As we have to retrieve all the records , so we will leave Query parameter fields as blank.
The output of the query has been assigned to a local collection named TechnologyRecords that is of type IList< Technologies >
4. Next step is to loop through the records with a For Each activity as shown below.
5. The Category attribute in the Resource tab appears as a string even though we defined this field as a Choice Set when creating the entity. Therefore, using the ToString() conversion on the Category attribute will not return the expected results.
6.As the Category can contain more than one value,so we will add a nested For Each Activity.
Apply filter on Choice Sets
We will configure the Query Entity Records Activity to apply a filter on the Technology Records in Data Services. These filters will return only those Blog articles that belong to one or more Category values specified in the filter.
Here, we will pull down only those Technology records that are classified under labels “RPA” .
we can also pull down those technology records that are classified under labels “RPA” or “AI”
I hope you enjoyed tha article!!