Please I have designed a form with htmlform entry and written a query with mySQL but anytime I edit a form and make changes on an observation and enter the form, these changes do not take effect in my query. Example if on the form Gender I select “Male” and save and late edit it to “FEMALE” the query still returns “MALE”. Please help me on this if there’s something on the obs table am missing
How does your query look like?
SELECT DISTINCT e.date_created as Date, i.identifier AS ‘TMC ID’, given_name AS ‘First Name’, family_name AS Surname, middle_name AS ‘Other Names’, year(curdate())-year(birthdate) as Age, pa.gender AS Gender, oo1.value_text as ‘NHIS No.’, n1.name as ‘Visit type’, oo3.value_text as ‘Diagnosis’, Upper(n.name) as ‘G-DRG’, oo4.value_numeric as ‘Service Cost’, oo5.value_numeric as ‘Drug Cost’, ( oo4.value_numeric + oo5.value_numeric) as ‘Total’
FROM openmrs.concept_name as n, openmrs.concept_name as n1, openmrs.visit as o LEFT JOIN openmrs.patient_identifier as i ON o.patient_id = i.patient_id LEFT JOIN openmrs.person_name as p ON o.patient_id = p.person_id LEFT JOIN openmrs.person as pa ON pa.person_id=o.patient_id left join openmrs.obs as oo1 ON oo1.person_id = pa.person_id left join openmrs.obs as oo2 ON oo2.person_id = pa.person_id
left join openmrs.obs as oo3 ON oo3.person_id = pa.person_id
left join openmrs.obs as oo4 ON oo4.person_id = pa.person_id
left join openmrs.obs as oo5 ON oo5.person_id = pa.person_id
left join openmrs.obs as oo6 ON oo6.person_id = pa.person_id
left join openmrs.encounter as e ON e.patient_id = p.person_id
e.date_created >= 2010-01-01 and e.date_created <= curdate() and identifier regexp ‘^NH’ and oo1.concept_id = 163995 and oo2.concept_id = 164071 and oo2.value_coded = n.concept_id and oo3.concept_id = 164021 and oo4.concept_id = 164075 and oo5.concept_id = 164286 and oo6.concept_id = 164010 and oo6.value_coded = n1.concept_id and e.form_id = 19 GROUP BY Date asc
Are you sure the gender changes are successfully saved. Try exit the form and check again.
Yes please they’re successfully changed. I don’t know if its a bug in HTMLform entry module because any time i edit a form the last observation is still saved instead of the new one overwriting the old observation . so when you run a query you end up getting the old values not the new ones
What does your HTML Form look like?