annikoff/redmine_plugin_computed_custom_field

How to get all values from a list with multiple choice?

Warlib1975 opened this issue · 16 comments

I need to get all values from a list with possibility of multiple choice. If I use simple expression like cfs[7] - I get only one value. And how to set multiple choices.

I need a decision for simple List and List (key/value).

Thank you.

It works well.
_101
_100
_098
_099

A key/value list I will check later.

A key list works well too.

Thank you. But I don't understand what a code do you use to read values?

cfs[1] and cfs[3]. Did you check "Multiple values" checkbox for computed list?
_102

I suppose, I described task not properly.

I have several types of Redmine list controls with multiple selection. And I have some computed control (text) where I need to show some result depending on what values selected in Lists. E.g. some list cfs[7] have 4 values, user selected 2 of them. I need to check which of them are selected. So, how to get the selected values to check.

#28

LIST_CF_ID = 1

values = custom_field_value(LIST_CF_ID) || [] 
case 
 when values.include?('item 2') 
 1
 when values.include?('item 1') && values.include?('item 3')
 2
else
 3
end 

@msneet thank you.

Thank you. And how properly set values for different list types?

Is it possible, to set values for the list of different types?

Please show some example.

E.g. three list on the form:

  1. Mobile operator (multiple selection of MNO). List type: key/value.
  2. Task type (multiple selection, e.g. WAP, WEB, etc.). Typical list type.
  3. Task complexity. Single value. List key/value. It depends on two first ones.

When front-end developer choose first 2 ones, the 3-d line must be changed corresponding some formula to calculate complexity. If user manually change complexity list, then stop using formula.

You could use different custom fields in your formula but you could not change computed custom field manually.

  1. Task complexity - it's not a computed custom field. It's simple custom field.

Is this issue is still actual for you?

Not actual already. Thank you.