I have actually achieved it using the very same script you sent by copying and pasting it in Navicat for MySQL and the results are really great. Thanks again for the help.
Ketta On Fri, Feb 24, 2012 at 10:52 PM, James Arbaugh <[email protected]>wrote: > Hi Ketta,**** > > ** ** > > If you’re interested in an immediate work-around you could write some > custom SQL and put it into a BIRT report. The following SQL might get you > close to where you’re wanting to go…**** > > SELECT (SELECT name FROM form WHERE form.form_id=encounter.form_id) as > 'Form Name', count( form_id ) as 'Number Completed'**** > > FROM `encounter`**** > > WHERE voided =0 **** > > AND encounter_datetime > DATE_SUB(NOW(),INTERVAL 1 YEAR)**** > > AND patient_id=YOUR_PATIENT_ID**** > > GROUP BY form_id**** > > ** ** > > It yields something like this…**** > > Form > Name<http://intranet.hashaiti.org:81/phpMyAdmin/sql.php?db=openmrs&table=encounter&sql_query=SELECT+%28SELECT+name+FROM+form+WHERE+form.form_id%3Dencounter.form_id%29+as+%27Form+Name%27%2C+count%28+form_id+%29+as+%27Number+Completed%27%0AFROM+%60encounter%60%0AWHERE+voided+%3D0+%0AAND+encounter_datetime+%3E+DATE_SUB%28NOW%28%29%2CINTERVAL+1+YEAR%29%0AAND+patient_id%3D602158%0AGROUP+BY+form_id+ORDER+BY+%60Form+Name%60+ASC&token=1777702b58b0350bc8cd5005e2f7254c> > **** > > Number > Completed<http://intranet.hashaiti.org:81/phpMyAdmin/sql.php?db=openmrs&table=encounter&sql_query=SELECT+%28SELECT+name+FROM+form+WHERE+form.form_id%3Dencounter.form_id%29+as+%27Form+Name%27%2C+count%28+form_id+%29+as+%27Number+Completed%27%0AFROM+%60encounter%60%0AWHERE+voided+%3D0+%0AAND+encounter_datetime+%3E+DATE_SUB%28NOW%28%29%2CINTERVAL+1+YEAR%29%0AAND+patient_id%3D602158%0AGROUP+BY+form_id+ORDER+BY+%60Number+Completed%60+ASC&token=1777702b58b0350bc8cd5005e2f7254c> > **** > > Vizit nan Pòs Swen Sante**** > > 5**** > > Notifikasyon Malnitrisyon**** > > 25**** > > ** ** > > You could either use YOUR_PATIENT_ID as a variable that you enter when the > report is run (if doing so, you should probably do a lookup of using the > identifier), or use the Reports tab on the patient dashboard and have it > run for that patient.**** > > ** ** > > You can find more information on the BIRT Module on the wiki at…**** > > https://wiki.openmrs.org/display/docs/BIRT+Report+Module**** > > ** ** > > Thanks,**** > > James**** > > ** ** > > *From:* [email protected] [mailto:[email protected]] *On > Behalf Of *Ketta Levi Martin > *Sent:* Friday, February 24, 2012 4:59 AM > *To:* [email protected] > *Subject:* [OPENMRS-IMPLEMENTERS] Having a Count of Entry Records Using > OpenMRS**** > > ** ** > > Hi, > I would like to know if there is a possibility of having a count of > entries/forms for a patient in a given period(e.g. One Year). > Could there be a module to do that within the Cohort Analysis tab? > > -- > Martin Levi Ketta**** > > P.O. Box 1292**** > > Masaka - Uganda > Mob: +256 752808383**** > > ** ** > ------------------------------ > > Click here to > unsubscribe<[email protected]?body=SIGNOFF%20openmrs-implement-l>from > OpenMRS Implementers' mailing list > **** > ------------------------------ > Click here to > unsubscribe<[email protected]?body=SIGNOFF%20openmrs-implement-l>from > OpenMRS Implementers' mailing list -- Martin Levi Ketta P.O. Box 1292 Masaka - Uganda Mob: +256 752808383 _________________________________________ To unsubscribe from OpenMRS Implementers' mailing list, send an e-mail to [email protected] with "SIGNOFF openmrs-implement-l" in the body (not the subject) of your e-mail. [mailto:[email protected]?body=SIGNOFF%20openmrs-implement-l]

