Html Form entry - How to display data using concept IDs

16 views
Skip to first unread message

kim samaniego

unread,
Jul 2, 2012, 11:27:08 PM7/2/12
to implem...@openmrs.org
Hi! May I ask how you display the contents of the data by just using the concept IDs? I tried lookup but it only works with patient and personattributes. Im creating forms using concept Ids only. Hope you could help. Thanks!

Jordan Kellerstrass

unread,
Jul 3, 2012, 12:40:33 AM7/3/12
to implem...@openmrs.org
Hi! I am not sure if this answers your question so maybe someone can correct and/ or add to this idea. The HTML Form Entry Module has these examples of using conceptIds to create forms:

Simple examples to copy-and-paste. Full reference at http://wiki.openmrs.org/x/kg8z

NUMERIC OBSERVATION
<obs conceptId="id-of-numeric-concept" labelText="Label before"/>

DATE OBSERVATION
<obs conceptId="id-of-date-concept" labelText="Label before"/>

CODED OBSERVATION
(as a dropdown)
<obs conceptId="id-of-coded-concept" labelText="Label before"/>
(as radio buttons)
<obs conceptId="id-of-coded-concept" labelText="Label before" style="radio"/>
(as an autocomplete)
<obs conceptId="id-of-coded-concept" labelText="Label before" style="autocomplete" answerClasses="Diagnosis"/>
(as a checkbox for a specific answer)
<obs conceptId="id-of-coded-concept" labelText="Label before" answerConceptId="id-of-answer-concept" answerLabel="label for answer"/>
(as a dropdown with specific choices)
<obs conceptId="id-of-coded-concept" labelText="Label before" answerConceptIds="concept-id-1,concept-id-2,concept-id-3" answerLabels="Label 1,Label 2, Label 3"/>


FREE TEXT OBSERVATION
(as a normal text field)
<obs conceptId="id-of-text-concept" labelText="Label before"/>
(as a textarea)
<obs conceptId="id-of-text-concept" labelText="Label before" rows="4" cols="80"/>

Does this help?

- Jordan


On Mon, Jul 2, 2012 at 10:27 PM, kim samaniego <saman...@gmail.com> wrote:
Hi! May I ask how you display the contents of the data by just using the concept IDs? I tried lookup but it only works with patient and personattributes. Im creating forms using concept Ids only. Hope you could help. Thanks!

Darius Jazayeri

unread,
Jul 3, 2012, 1:03:03 AM7/3/12
to implem...@openmrs.org
Hi Kim,

Are you trying to display data, or enter data?

If you're trying to display data entered some other way, you can use the <lookup> tag with the latestObs or allObs functions. (See https://wiki.openmrs.org/display/docs/HTML+Form+Entry+Module+HTML+Reference#HTMLFormEntryModuleHTMLReference-%3Clookup%3E)

To enter data you do something like:
<obs labelText="Weight" conceptId="5089"/>

-Darius

kim samaniego

unread,
Jul 3, 2012, 2:14:54 AM7/3/12
to implem...@openmrs.org
Hi Jordan and Darius, i'm trying to display data. That is not an attribute of a patient because I only used concept IDs when I ask for input, for example:

This is an input field for the mother's education:
 <obs conceptId="160322" id="partnersName" labelText="Mother's Education: "/>

Then how can I display the entered data in another form?
I tried this: <lookup expression="160322"/> and other lookups.
None worked :(

Darius Jazayeri

unread,
Jul 3, 2012, 2:27:32 AM7/3/12
to implem...@openmrs.org

Ishara Premadasa

unread,
Jul 3, 2012, 3:06:24 AM7/3/12
to implem...@openmrs.org
Hi Kim,

As Darius has suggested you can display the entered data for Mother's Education in another form in the following way. (though i am not sure this is exactly what you need.)

In form 1,

<obs conceptId="160322" id="partnersName" labelText="Mother's Education: "/>

In the other form where you need this data you can have a complex velocity expression to get the latest submitted observation under this concept id, and display the valueText in it.

In form 2,

<td>Mother's Education:</td>
<td><lookup complexExpression="#set($val = $fn.latestObs(160322)) ${val.valueText}"/></td>

So in your 2nd form it should auto display some value as,

Mother's Education: Grad School  etc. when you open the form. Make sure concept 160322 exists and i am assuming its DataType is 'Text'.

Hope this helps. :)
Ishara
--
Ishara Premadasa,
Google Summer of Code Intern 2012,
Dept. of Computer Science and Engineering,
University of Moratuwa,
Sri Lanka.

kim samaniego

unread,
Jul 3, 2012, 4:24:54 AM7/3/12
to implem...@openmrs.org
Thanks Ishara and Darius! Actually I already tried fn.latestObs() but didnt know the correct way of using it. Im gonna try your suggestion Ishara, will update you guys later. Thanks again for the help! :)


------

SAMANIEGO, Kim P.

Software Developer (CHITS)

National TeleHealth Center
University of the Philippines, Manila
3rd floor IT Complex, Philippine General Hospital
Taft Avenue, Ermita, Manila, Philippines 1000
Telefax: +63 02 5256501


On Tuesday, July 3, 2012 11:27:08 AM UTC+8, kim samaniego wrote:
Hi! May I ask how you display the contents of the data by just using the concept IDs? I tried lookup but it only works with patient and personattributes. Im creating forms using concept Ids only. Hope you could help. Thanks!

On Tuesday, July 3, 2012 11:27:08 AM UTC+8, kim samaniego wrote:
Hi! May I ask how you display the contents of the data by just using the concept IDs? I tried lookup but it only works with patient and personattributes. Im creating forms using concept Ids only. Hope you could help. Thanks!

On Tuesday, July 3, 2012 11:27:08 AM UTC+8, kim samaniego wrote:
Hi! May I ask how you display the contents of the data by just using the concept IDs? I tried lookup but it only works with patient and personattributes. Im creating forms using concept Ids only. Hope you could help. Thanks!

On Tuesday, July 3, 2012 11:27:08 AM UTC+8, kim samaniego wrote:
Hi! May I ask how you display the contents of the data by just using the concept IDs? I tried lookup but it only works with patient and personattributes. Im creating forms using concept Ids only. Hope you could help. Thanks!

On Tuesday, July 3, 2012 11:27:08 AM UTC+8, kim samaniego wrote:
Hi! May I ask how you display the contents of the data by just using the concept IDs? I tried lookup but it only works with patient and personattributes. Im creating forms using concept Ids only. Hope you could help. Thanks!

On Tuesday, July 3, 2012 11:27:08 AM UTC+8, kim samaniego wrote:

kim samaniego

unread,
Jul 3, 2012, 4:39:05 AM7/3/12
to implem...@openmrs.org
Wow guys thank you so much! :) It worked! :D 

THANKS Ishara, Darius and Jordan!
Reply all
Reply to author
Forward
0 new messages