Using Case calculations

5 views
Skip to first unread message

Ukang'a Dickson

unread,
May 22, 2013, 10:18:20 AM5/22/13
to bambo...@googlegroups.com
I have the following calculation that is failing with :
   case dob_known == "yes": ((form_date_of_death - form_dob)/86400)/365, default: form_age

I want to calculate the age if the dob is known or simply return the value contained in the field form_age. The idea is to be able to query based on the calculated age field. What am I doing wrong?

Regards,
- Ukang'a

Ukang'a Dickson

unread,
May 23, 2013, 5:36:22 AM5/23/13
to bambo...@googlegroups.com
I have ended up in creating calculation for ((form_date_of_death - form_dob)/86400)/365 and referred to it in my case formula. It seems also I need to have the case in "", am using:
{
    "name": "calculated_age",
    "formula": "\"case form_dob_known in ['yes']\": calculate_age,\"default\":form_age"
}
This gets added as a calculation but is not evaluated as expected as it only returns the calculate_age, it does not return  default even if the evaluation is not met.
I also think the test_calculations is not run coz this should fail https://github.com/modilabs/bamboo/blob/master/bamboo/tests/core/test_calculations.py#L60.


Regards,
- Ukang'a

Prabhas Pokharel

unread,
May 23, 2013, 8:27:38 AM5/23/13
to bambo...@googlegroups.com

Dickson, quick question, since this might matter, you are using pybamboo?

--
You received this message because you are subscribed to the Google Groups "bamboo-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bamboo-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ukang'a Dickson

unread,
May 23, 2013, 8:30:27 AM5/23/13
to bambo...@googlegroups.com
I am using pybamboo with the mvp stuff, but I do test first with curl, before I push anything to pybamboo.


Regards,
- Ukang'a

Peter Lubell-Doughtie

unread,
May 23, 2013, 11:49:24 AM5/23/13
to bambo...@googlegroups.com

This looks like an error, can you create a github issue for this?  I'm away this week, but will look at this on Sunday.

Thanks,
Peter

Reply all
Reply to author
Forward
0 new messages