Program rules combining several Dataelements. Not working?

Hi devs.

Are ‘complex’ program rules working? I mean by ‘complex’ combining different datalements. For example:

#{CurrentMethod} == ‘[35] IUD’ && #{AdoptedMethod} == ‘[35] UID’ && #{ServiceProvided} != ‘[38] IUD removal’

But when I check the value of the expresion in the JS console I get the following information:

Expression with id rule:M8qUeTSwhnF was successfully run. Original condition was: #{CurrentMethod} == ‘[35] IUD’ && #{AdoptedMethod} == ‘[35] UID’ && #{ServiceProvided} != ‘[38] IUD removal’ - Evaluation ended up as:‘[35] IUD’ == ‘[35] IUD’ && ‘[35] IUD’ == ‘[35] UID’ && ‘[42] MA’ != ‘[38] IUD removal’ - Result of evaluation was:false

The result should be true, right? Am I doing something wrong?

Regards

Jose

Hi there Jose,
the example you gave should work fine.

It seems the reason that your particular espression is not evaluated to true(triggering the actions you hooked to the rule), is the middle clause of your expression:

#{AdoptedMethod} == '[35] UID'

This evaluates to:

'[35] IUD' == '[35] UID'

..which is false. Can it be only a typo in the expression or the data element value - the U and I should be switched around?

Best regards,
Markus

···

1. jun. 2016 kl. 15.17 skrev Jose Garcia Muñoz <josemp10@gmail.com>:

Hi devs.

Are 'complex' program rules working? I mean by 'complex' combining different datalements. For example:

#{CurrentMethod} == '[35] IUD' && #{AdoptedMethod} == '[35] UID' && #{ServiceProvided} != '[38] IUD removal'

But when I check the value of the expresion in the JS console I get the following information:

Expression with id rule:M8qUeTSwhnF was successfully run. Original condition was: #{CurrentMethod} == '[35] IUD' && #{AdoptedMethod} == '[35] UID' && #{ServiceProvided} != '[38] IUD removal' - Evaluation ended up as:'[35] IUD' == '[35] IUD' && '[35] IUD' == '[35] UID' && '[42] MA' != '[38] IUD removal' - Result of evaluation was:false

The result should be true, right? Am I doing something wrong?

Regards
Jose
_______________________________________________
Mailing list: DHIS 2 developers in Launchpad
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : DHIS 2 developers in Launchpad
More help : ListHelp - Launchpad Help

god… sorry Markus.

However, the following expression is still giving me a false value (hope there is no other mistake, I double checked :slight_smile: )

Expression with id rule:M8qUeTSwhnF was successfully run. Original condition was: #{CurrentMethod} == ‘[35] IUD’ && #{AdoptedMethod} == ‘[35] IUD’ && #{ServiceProvided} != ‘[38] IUD removal’ - Evaluation ended up as:‘[35] IUD’ == ‘[35] IUD’ && ‘[35] IUD’ == ‘[35] IUD’ && ‘[42] MA’ != ‘[38] IUD removal’ - Result of evaluation was:false

Thanks Markus

···

On Wed, Jun 1, 2016 at 4:29 PM, Markus Bekken markus.bekken@gmail.com wrote:

Hi there Jose,

the example you gave should work fine.

It seems the reason that your particular espression is not evaluated to true(triggering the actions you hooked to the rule), is the middle clause of your expression:

#{AdoptedMethod} == ‘[35] UID’

This evaluates to:

‘[35] IUD’ == ‘[35] UID’

…which is false. Can it be only a typo in the expression or the data element value - the U and I should be switched around?

Best regards,

Markus

  1. jun. 2016 kl. 15.17 skrev Jose Garcia Muñoz josemp10@gmail.com:

Hi devs.

Are ‘complex’ program rules working? I mean by ‘complex’ combining different datalements. For example:

#{CurrentMethod} == ‘[35] IUD’ && #{AdoptedMethod} == ‘[35] UID’ && #{ServiceProvided} != ‘[38] IUD removal’

But when I check the value of the expresion in the JS console I get the following information:

Expression with id rule:M8qUeTSwhnF was successfully run. Original condition was: #{CurrentMethod} == ‘[35] IUD’ && #{AdoptedMethod} == ‘[35] UID’ && #{ServiceProvided} != ‘[38] IUD removal’ - Evaluation ended up as:‘[35] IUD’ == ‘[35] IUD’ && ‘[35] IUD’ == ‘[35] UID’ && ‘[42] MA’ != ‘[38] IUD removal’ - Result of evaluation was:false

The result should be true, right? Am I doing something wrong?

Regards

Jose


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp