Careful with those expressions... "!assignTo.timeHours" returns a *set*
of numbers, with *no* duplicate. That means that if a person is assigned
2 tasks, and he spent 10 hours on each task, then "!assignTo.timeHours"
returns a set of one number, namely 10. And the sum will be incorrectly
computed as 10 instead of 20. To fix this, you need to use the .@
operator instead of the . operator. The correct expression is
add([EMAIL PROTECTED])
The .@ operator (and the !@ operator) keeps the duplicates.
David
Fruch wrote:
>
> David Huynh-2 wrote:
>
>> Fruch wrote:
>>
>>> I have those items:
>>>
>>> {
>>> type : "Task",
>>> label : "Building a New Site for A",
>>> assignTo: "Bibi",
>>> status : "Done",
>>> timeHours : "10"
>>> },
>>> {
>>> type : "Task",
>>> label : "Building a New Site for B",
>>> assignTo: "Bibi",
>>> status: "Current"
>>> timeHours : "25"
>>> }
>>>
>>> how do I Sum all the timeHours of Tasks.
>>>
>>>
>> Could you provide more context? Where do you want the sum to appear?
>>
>> David
>>
>>
>>
>
> I actually found a way to sum all the properties, and show them in a view of
> a person ( add(!assignTo.timeHours) , was used to show all the tasks time a
> person did)
>
> {
> type : "Person",
> label : "Bibi"
> }
>
> but I came into a problem when I wanted to sum only the not "Done" tasks,
> which mean summing by criteria.
>
> More example on the way to use expression could be useful
>
_______________________________________________
General mailing list
[email protected]
http://simile.mit.edu/mailman/listinfo/general