David Huynh-2 wrote:
> 
> 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
> 
> 

It's an impotent remark, didn't see coming... the @ operator isn't referred
any ware, I'm seen it in the code, but the code isn't documented at all. so
I didn't got what is @ for. (and I've found out about <> and  form the code
too, tried it first with !=, until I've found out that ! is for traversing)

but still my last question was not answer (don't get me the wrong way, it's
sounds a bit pushy :))
summing with criteria is really why I've started this thread  (and learn
some new things along the way:))

I have load of other question, but I guess I'll put them in a separate
thread.

thanks David, for preventing me from falling into a pit.
-- 
View this message in context: 
http://www.nabble.com/How-to-Sum-a-list-of-numbers-tp14356032p14366763.html
Sent from the SIMILE - General mailing list archive at Nabble.com.

_______________________________________________
General mailing list
[email protected]
http://simile.mit.edu/mailman/listinfo/general

Reply via email to