cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.

Set a dropdown field with "Computed as"

CM_9399659
5-Regular Member

Set a dropdown field with "Computed as"

Does anyone know the correct syntax to set a dropdown field using the "Computed as" logic? For example if I want to automatically set a dropdown to option id 1, how would I do that? I have tried several things, such as choiceField[2][1], choiceField[2][0]_option[1], etc, from the Codebeamer documentation but nothing seems to work.

ACCEPTED SOLUTION

Accepted Solutions
Nico_M
6-Contributor
(To:CM_9399659)

Dear Chris,

 

Sorry my bad, forgot one crucial thing:

  • As every choiceField is also a collection (even if its single-choice), you need to put a List() around your computed option, so in your example:
  • List(choiceList[4]_$option[1])

Let me know if that does the trick 🙂

 

Cheers,

 

Nico

 

View solution in original post

7 REPLIES 7
Nico_M
6-Contributor
(To:CM_9399659)

Hi,

 

The syntax is <propertyNameofTheChoiceField>_$option[<optionID>]

So for example if you want to calculate that the field choiceList[1] should have the 2nd option selected by computation, this would be the syntax:

choiceList[1]_$option[2]

 

This is also described here in the documentation (just not indexed well in the table of contents): https://codebeamer.com/cb/wiki/25722#section-Context+Variables

 

Hope this helps,

 

Cheers,

 

Nico

CM_9399659
5-Regular Member
(To:Nico_M)

Hey Nico,

 

Thank you for your reply.

 

I have tried the syntax you have mentioned from the documentation. This does not allow me to save the changes to the field. I get an error: 

 

Compiling "choiceList[4]_$option[1]" to compute "Validated Cycle/Vendor (AMISC1-6)" failed: "Cannot convert of type class com.intland.codebeamer.persistence.dto.ReadOnlyChoiceOptionDto to interface java.util.List" Please save the tracker configuration before you use newly added fields in expressions.

CM_9399659_0-1725887895020.png

 

Do you have any idea why this might be?

 

Chris

Nico_M
6-Contributor
(To:CM_9399659)

Dear Chris,

 

Sorry my bad, forgot one crucial thing:

  • As every choiceField is also a collection (even if its single-choice), you need to put a List() around your computed option, so in your example:
  • List(choiceList[4]_$option[1])

Let me know if that does the trick 🙂

 

Cheers,

 

Nico

 

Hey Nico,

 

That worked!

 

Thank you for the help.

Hi @CM_9399659 ,


I wanted to see if you got the help you needed.


If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.
Please note that industry experts also review the replies and may eventually accept one of them as solution on your behalf.


Of course, if you have more to share on your issue, please pursue the conversation.

Thanks,

Catalina
PTC Community Moderator

Hey Catalina,

 

I don't see the "Reply as Accepted Solution" button on my screen.

 

CM_11253122_0-1726076708797.png

 

Hi @CM_11253122,

 

Only the author of the topic, in our case @CM_9399659, can mark a reply as the Accepted Solution.

 

Thanks!

Catalina
PTC Community Moderator
Announcements


Top Tags