Hi James,

There are several reasons why doing this seems error-prone from a workflow
perspective, but I'll trust that you've thought things through.

I believe you could do the following:
* use the logic module to write a rule (in groovy) which returns the
highest-so-far obs for any patient for that concept. (You can do that with
the ObsService.getObservations method, with mostRecentN=1 and
sort="valueNumeric desc". Then add 1.)
* Do a <lookup/> tag where you call that logic rule.
* Do some javascript craziness to put that value from the lookup into an obs
field.

-Darius

On Thu, Sep 15, 2011 at 10:06 AM, James Arbaugh <[email protected]>wrote:

> When designing an HTML form, or xForm, is there a way to pre-populate the
> field in the form with the next consecutive number for that observation
> type?  We’re evaluating entering our blood bank data into OpenMRS.  One of
> the fields to be entered is the serial number for the bag of donated blood.
> Every year the serial number starts over at 1.  The bags don’t have a serial
> number printed on them, but it’s written on by hand.  In the current patient
> registry it’s easy to look on the line above and see what the last serial
> number was, and what to write on the bag.  In the patient form, it’s not so
> easy anymore.  I suspect the clerks would have trouble keeping track of the
> last serial number, and I would like the form to be able to do that for
> them.  Since the serial number is not patient specific, I doubt the <lookup>
> tag would work.  Is there perhaps a way to do this with JavaScript?  Any
> suggestions for this complex problem.****
>
> ** **
>
> Thanks,****
>
> James Arbaugh****
>
> Hospital Albert Schweitzer Haiti****
> ------------------------------
> Click here to 
> unsubscribe<[email protected]?body=SIGNOFF%20openmrs-implement-l>from
>  OpenMRS Implementers' mailing list

_________________________________________

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]

Reply via email to