DataService Entry with ChoiceSet Value Read from Process

Hi All,
Need your inputs on the Data service entry record with a choice set variable type.

I have a Data Service Entity with some entity records. One of the filed is choice set allowed to multiple choices.

When i am trying to find and print the values of this entity records, all other record values are able to extract normally except the ChiceSet Column.

** Instead of Display Name its giving only the Name value(s) Such as : C1, C3…etc

How i can get/read/extract the display name saved in a DataService Entity Record ??

Your help is greatly appreciated.

@KrishnaKishore

Are you on legacy or vb?

Is the choiceset output saved to a variable.?

How are you trying to extract

Cheers

Hi @Anil_G
We are using VB. Steps followed:

  1. Get the Data entity record by using proper query filters
  2. Loop through the records in for each loop.
  3. Reading each record and logging the value. (Write line or Log message)
  4. For the ChoiceSet Col. Value for the entity record, loop through and print all the saved choice values. (Multiple Choice set option is selected while creating the data field in Data service entity).
  5. So the print is only giving “Name” instead of Display name:

Ex:
Data Entity Records
Headers: ID, Str1, Str2, CSetValues
Row#1: 123, First, CAR, (Name)
Row#2: 456, Second, BUS, (Name, Email)
Row#3: 789, Third, Trian, (Name, Phone)
Row#4: 012, Fourth, Ship, (Phone, Email)
Row#5: 345, Five, Flight, (Phone, Email, Name, N/A)

For the above Data entities, the “CSetValues” Col.Values for all the rows is coming as
C1, (C1, C3), (C1, C2), (C2, C3), (C2, C3, C1, C4)

My requirement is print/get the display names like Phone, Name, Email or N/A.

How we can get these “DISPLAY NAMES” of a Data Service Entity record ??

Hi @KrishnaKishore

Try this way:

Assign activity:
choiceToDisplayName = New Dictionary(Of String, String) From {
    {"C1", "Name"},
    {"C2", "Phone"},
    {"C3", "Email"},
    {"C4", "N/A"}
}

For Each Row in dataTable.Rows
    Write Line: "ID: " + Row("ID").ToString + ", Str1: " + Row("Str1").ToString + ", Str2: " + Row("Str2").ToString
    
    Assign: choiceSetValue = Row("CSetValues").ToString
    
    For Each choiceValue in choiceSetValue.Split(","c)
        If choiceToDisplayName.ContainsKey(choiceValue.Trim()) Then
            Write Line: "Choice Display Name: " + choiceToDisplayName(choiceValue.Trim())
        End If
    Next
End For Each

Hope it helps!!

Hi @Parvathy ,
Thanks for the solution.

The ChoiceToDisplay is a Data Service Entity Record instead of local Dictionary variable. The record is created by UiPath Apps.

So from the process, i need to query/filter/find the record and start using the row/col. values as part of the process. I was able to get all the other row/col values properly since these are normal text variables.

But when i tried to read the column value of choice Set data type, its coming only the Name instead of Display name shown in UiPath Data service Choice Set screen.

@KrishnaKishore

Can you show some screenshot of how you tried…like what datatype you used and what implementation is done

using intellisense did you check the methods and functions that are available?

cheers

Hi @Anil_G
Tried it.
For the reading the
Data Service Entity records → IList
Choice Set Value → Nullable

If the ChoiceSet value holds a single value, then Var.ToString will print the Name (Like C1, C3…etc) , instead of Display Name Value.
If the ChoiceSet value holds a single value, then Var.ToString will print the as:
System.Collections.Generic.HashSet[ProcessName.DataServiceTableName]

Then i am looping through this HashSet, so it prints Name only (Like C1, C3…etc) instead of Display Name Value.

Screenshot 2023-08-28 100804

Hi All - any help on the issue mentioned ?

Any updates on this? I have a similar problem. @KrishnaKishore @Anil_G

Hey ,

Just trying to understand something, I see that it is taking the name instead of display name while looping over them, however , did you encounter any problem in your App if you do not check the Show name check box?

I tried to explore as well, when we query the entity records , it only extracts the “Name” when the “Show name” checkbox is checked. IF we try to do it without checking the checkbox , it gets the display name.

image

image

1 Like

My query is different.

  1. There is a choicesets created and
  2. Also created a field in an entity of choicesets type, that I created in step 1.

I want to fetch records (using ‘Query Entity Record’ activity) based on one value from choicesets. Looks like activity is expecting a value of type choicesets not String. How can I fetch record with one of the specific value from the choicesets?

Hey Ashish,

Please refer this discussion on forum -

In this, it is well explained , the idea here would be to use the index of the choice in the choice set (when created)
image

This choice set , when you try to assign in the data service entity , will order alphabetically . Please do not use that as the index. Use the index of the choices while creation.

Refer the SS attached along side the link of article .(article has C# used, I tried the same using VB and this is how it works, index will start from 0)

Let me know if it helps.

Thanks @abhishek.padalkar , Is that setting for all the choice sets you selected ?

Yes Sir . It is indeed.