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 ?