[ 
http://mifosforge.jira.com/browse/MIFOS-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=60376#action_60376
 ] 

Van Mittal-Henkle commented on MIFOS-3827:
------------------------------------------

First pass at a query to calculate a PPI score:

select @tmp_ppi_score:=sum(
case 
        when Q1='Five or more' then 0
        when Q1='Four' then 4
        when Q1='Three' then 8
        when Q1='Two' then 13
        when Q1='One' then 20
        when Q1='None' then 27
end +
case 
        when Q2='Labourers (agricultural, plantation, other farm), hunters, 
tobacco preparers and tobacco product makers, and other labourers' then 0
        when Q2='Others' then 8
        when Q2='Professionals, technicians, clerks, administrators, managers, 
executives, directors, supervisors, and teachers' then 14
end +
case 
        when Q3='No'then 0
        when Q3='Yes' then 4
end +
case 
        when Q4='Firewood and chips, charcoal, or none'then 0
        when Q4='Others' then 5
        when Q4='LPG' then 17
end +
case 
        when Q5='No'then 0
        when Q5='Yes' then 6
end +
case 
        when Q6='No'then 0
        when Q6='Yes' then 5
end +
case 
        when Q7='No'then 0
        when Q7='Yes' then 3
end +
case 
        when Q8='No'then 0
        when Q8='Yes' then 6
end +
case 
        when Q9='None'then 0
        when Q9='One' then 6
        when Q9='Two or more' then 9
end +
case 
        when Q10='None'then 0
        when Q10='One' then 5
        when Q10='Two or more' then 9
end
)
from ppi_survey_results
where ppi_results_id = 10;

update ppi_survey_results set ppi_score = @tmp_ppi_score where ppi_results_id = 
10;



> PPI spike: write SQL to calculate a PPI score for a completed India PPI survey
> ------------------------------------------------------------------------------
>
>                 Key: MIFOS-3827
>                 URL: http://mifosforge.jira.com/browse/MIFOS-3827
>             Project: mifos
>          Issue Type: Story
>            Reporter: Van Mittal-Henkle
>            Assignee: Van Mittal-Henkle
>            Priority: Major
>             Fix For: Release E - Iteration 8
>
>
> Get basic calculation working in SQL for calculating a PPI score from a 
> completed India PPI survey.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://mifosforge.jira.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Mifos-issues mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mifos-issues

Reply via email to