I tried to use the great Logic Rule Darius documented, but it didn't
work in the HTML form.  The rule works properly when I "Test Logic
Expressions".  

 

When I try to use logic in the HTML form, like <includeIf
logicTest="GENDER = F">Show this text</includeIf> it works.  

 

But, if I try to use the AGE rule, it displays for any patient that I
try.  My AGE html code looks like this... 

<includeIf logicTest="AGE = 33.0">.</includeIf> It shows the period (.)
no matter what the age of the patient.  Likewise, if I do something
like... <includeIf logicTest="AGE < 16">.</includeIf>, it shows the
period for patients of any age. 

 

What I'd really like would be able to show/hide stuff if a patient was
between certain ages, but I can't even seem to make the basic rule work.

 

I'm using OpenMRS Version: 1.8.2, and HTML Form Entry 1.7.3, and Logic
Module 0.5.

 

I chatted with Darius at length, and the bug actually already exists:
https://tickets.openmrs.org/browse/LOGIC-35

 

So, Evelyn (and anyone else that needs this functionality) go vote for
the ticket.

 

Thanks,

James

 

From: [email protected] [mailto:[email protected]] On
Behalf Of Darius Jazayeri
Sent: Wednesday, August 10, 2011 6:37 PM
To: [email protected]
Subject: Re: [OPENMRS-IMPLEMENTERS] HTML form entry "IncludeIF" for age

 

Hi Evelyn,

 

I just added an example of how to write the Age rule on the User-Defined
Rules <https://wiki.openmrs.org/x/doDP>  wiki page.

 

-Darius

 

PS- Mike, Evelyn, could both of you please go to the wiki, and do the
search that you'd naturally do to figure out "how do I write a logic
rule"? Then, make sure the User-Defined Rules page I linked to has those
search terms as labels. And make sure any other prominent hit has a link
to the User-Defined Rules page?

 

On Tue, Aug 9, 2011 at 7:38 AM, Michael Seaton <[email protected]> wrote:

Hi Evelyn,

I see you're right on the demo server.  That's unfortunate.  Looks like
you can either wait until the ticket that James sent is fixed and use
velocity, or you can author a new Age rule yourself using the "Rule
Definitions" section of the UI.

@Darius or Burke - do you have an example somewhere of either Java or
Groovy code that you could share to show how to do this?  Can you update
the Logic Module wiki pages with this if you are able to provide it?

Thanks,
Mike





On 08/09/2011 10:14 AM, Evelyn Castle wrote: 

Hi Mike, 

 

We are running OMRS version 1.8.2 and Logic Module 0.5.

 

When I look at the token's under admin>Logic Module>token registration,
AGE is not an option. Do I need to add it somehow?

 

I tired the code you sent. I am able to save the form without any errors
but the questions are omitted from the form, regardless of the patients
age.

 

Thanks

Evelyn

On Tue, Aug 9, 2011 at 2:11 PM, Michael Seaton <[email protected]> wrote:

Hi Evelyn,

What version of OpenMRS and the Logic Module are you using?  I know the
AGE token was broken in some previous versions, but I thought that had
been fixed.  You might want to see if upgrading Logic and/or OpenMRS
helps.

Alternatively, the includeIf tag supports velocity expressions as well.
It looks like the documentation needs to be expanded to include more on
the possibilities available with velocity.  I don't have this installed
to try it out currently, but try something like the following:

<includeIf velocityTest="$patient.age < 16"/>

Hopefully this works,
Mike 




On 08/09/2011 06:36 AM, Evelyn Castle wrote: 

        Hi All, 

         

        I am trying to use the HTML Form Entry module to include certain
questions in a form if the patient is a child (under 16). I am trying to
use the same logic that would be used if you were trying to include only
female patients. (we have this working fine in other forms)

         

        <includeIf logicTest="GENDER = F">

        
        
        
        

        But, in
        the logic test "token registration", age is not an option,
        only "birthdate" and "birthdate estimate". So how can I
        use the logic module to determine age since if I used
        birthdate, I would need to change the date every year in
        order for it to continue to show kids under 16.

        
        
        
        

        Anyone
        know how I can do this?

        
        
        
        

        Thanks

        Evelyn

        
        
        
        

        
        
        
        

        
        -- 
        Evelyn Castle
        Co-Director, eHealth Nigeria
        +1 415 545 8289 <tel:%2B1%20415%20545%208289>  (US)
        website: http://www.eHealthNigeria.org
        blog: http://www.evelyncastle.com
        skype: evelynlcastle

________________________________

        Click here to unsubscribe
<mailto:[email protected]?body=SIGNOFF%20openmrs-implement-l>
from OpenMRS Implementers' mailing list 

________________________________

Click here to unsubscribe
<mailto:[email protected]?body=SIGNOFF%20openmrs-implement-l>
from OpenMRS Implementers' mailing list 




-- 
Evelyn Castle
Co-Director, eHealth Nigeria
+1 415 545 8289 <tel:%2B1%20415%20545%208289>  (US)
website: http://www.eHealthNigeria.org
blog: http://www.evelyncastle.com
skype: evelynlcastle

________________________________

Click here to unsubscribe
<mailto:[email protected]?body=SIGNOFF%20openmrs-implement-l>
from OpenMRS Implementers' mailing list 

________________________________

Click here to unsubscribe
<mailto:[email protected]?body=SIGNOFF%20openmrs-implement-l>
from OpenMRS Implementers' mailing list 

 

________________________________

Click here to unsubscribe
<mailto:[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