I'm having a Field Collection 'My List' with two fields: 'Amount' (integer) and 'Date' (date). I often count the 'Amount' items with Rules like this:
- Add a variable: Parameter: Type: Integer, Value: 0, Provides variables: Sum
- Loop over [node:field-my-list]
- Calculate a value: Parameter: Input value 1: [sum], Input value 2: [my-list:field-amount], Provides variables: Result (result)
- Set a data value: Parameter: Data: [sum], Value: [result]
As setting up this loop every time takes quite some time, I thought that creating a Rules component (action set) would make things a lot easier. I tried this:
- Data type: List of field collection item items, Label: List, Usage: Parameter.
- Data type: Integer, Label: Sum, Usage: Provided.
Creating a loop (Parameter: List: [list], List item: Current list item (list_item)) works, but there's a problem when I try to calculate the value "Sum + List:item". Namely, I can only select list:0, list:1, list:2 and list:3 as "List:item". That doesn't seem to be right.
How can I correctly select an item from the list and use it in the calculation?