← Back to team overview

dhis2-devs team mailing list archive

Re: Program Rule

 

Calle

Yes, but the programe stage should appear when the expression is false, which is not happening. Even the warning message disappear when the expression is false.

Sent from my iPhone

> On Oct 8, 2018, at 11:03 PM, Calle Hedberg <calle.hedberg@xxxxxxxxx> wrote:
> 
> Hi
> 
> If the warning message appear when the dagnosis value is something else than meninges, then it means the expression correctly evaluated to TRUE.
>  So the expression is correct.
> 
> And the other action if expression is true, is to hide the meninges stage, yes? and that stage correctly does not appear?
> 
> Seems like you have what you want?
> 
> Regards
> Calle
> 
>> On Mon, 8 Oct 2018 at 21:26, Amjad Ata Allah <ataallah.amjad@xxxxxxxxx> wrote:
>> Thanks Calle
>> 
>> I replaced the OR with AND.
>> I added another action to the rule "Show warning message" for testing, and now the warning message appears but the program stage don't.
>> So the issue is with the program stage.
>> 
>> Any suggestions?
>> 
>> Regards,
>> 
>>> On Mon, Oct 8, 2018 at 2:41 PM Calle Hedberg <calle.hedberg@xxxxxxxxx> wrote:
>>> Amjad,
>>> 
>>> That error is a data-related error (I had something similar last week, and tracked it down to one single orgunit that had an erroneous attribute value - but in your case the data error might be somewhere else, no idea where). If you get that kind of error, it often results in other program rules not executing.
>>> 
>>> In any case, you cannot combine OR and NOT the way you do - then the expression is always true.
>>> 
>>> Regards
>>> Calle
>>> 
>>>> On Mon, 8 Oct 2018 at 13:37, Amjad Ata Allah <ataallah.amjad@xxxxxxxxx> wrote:
>>>> Dear Calle,
>>>> 
>>>> The case is that i have like 20 diagnosis, i need to hide the stage if the diagnose is not one of those 3 diagnosis and show the stage if its one of them.
>>>> 
>>>> I also tried the &&, but didn't work also.
>>>> 
>>>> After clearing the cache, i have this error:
>>>> TypeError: Cannot read property 'id' of undefined
>>>>     at dataentry-controller.js:405
>>>>     at Object.r [as forEach] (angular.js:331)
>>>>     at processRuleEffect (dataentry-controller.js:298)
>>>>     at dataentry-controller.js:201
>>>>     at n.$broadcast (angular.js:14785)
>>>>     at dhis2.angular.services.js:2873
>>>>     at angular.js:13248
>>>>     at n.$eval (angular.js:14466)
>>>>     at n.$digest (angular.js:14282)
>>>>     at n.$apply (angular.js:14571)
>>>> 
>>>> Regards,
>>>> 
>>>>> On Mon, Oct 8, 2018 at 1:27 PM Calle Hedberg <calle.hedberg@xxxxxxxxx> wrote:
>>>>> Hi
>>>>> 
>>>>> You only use the code if that has been specified in the option set (tick-box).
>>>>> 
>>>>> Secondly, you are using OR and NOT in your expression:
>>>>> 
>>>>> #{aDiagnose} != 'Meningitis - Other Bacterial' || #{aDiagnose} != 'Meningitis - Hemophillus Influenza' || #{aDiagnose} != 'Meningitis - Meningococcal Meningitis'
>>>>> 
>>>>> Basically that means the expression will always return true, at least if aDiagnose is a single value diagnosis field. Even if you select let us say "Meningitis - Mengingococcal Meningitis" as the aDiagnosis value, the three other components in the expression will be true so the total is true due to the OR....
>>>>> 
>>>>> Try using AND
>>>>> #{aDiagnose} != 'Meningitis - Other Bacterial' && #{aDiagnose} != 'Meningitis - Hemophillus Influenza' && #{aDiagnose} != 'Meningitis - Meningococcal Meningitis'
>>>>> 
>>>>> Meaning : when aDiagnosis is NOT diag1 AND not diag2 AND NOT diag3 then hide stage X
>>>>> 
>>>>> Regards
>>>>> Calle
>>>>> 
>>>>> 
>>>>> Regards
>>>>> Calle
>>>>> 
>>>>>> On Mon, 8 Oct 2018 at 09:11, Amjad Ata-Allah <ataallah.amjad@xxxxxxxxx> wrote:
>>>>>> Dear Zubair,
>>>>>> 
>>>>>> Yes it is, and i tried both (name and code).
>>>>>> 
>>>>>> Regards,
>>>>>> 
>>>>>> Sent from my iPhone
>>>>>> 
>>>>>>> On Oct 8, 2018, at 9:47 AM, Zubair Asghar Raja <zubair@xxxxxxxxx> wrote:
>>>>>>> 
>>>>>>> Hi Amjad 
>>>>>>> Is aDiagnose an option set? If it is then try using code instead of name.
>>>>>>> 
>>>>>>> 
>>>>>>> Zubair 
>>>>>>> 
>>>>>>> Den man. 8. okt. 2018, 6:50 a.m. skrev Amjad Ata Allah <ataallah.amjad@xxxxxxxxx>:
>>>>>>>> Hi Stephen
>>>>>>>> Here is the condition expression:
>>>>>>>> #{aDiagnose} != 'Meningitis - Other Bacterial' || #{aDiagnose} != 'Meningitis - Hemophillus Influenza' || #{aDiagnose} != 'Meningitis - Meningococcal Meningitis'
>>>>>>>> 
>>>>>>>> Thanks,
>>>>>>>> 
>>>>>>>>> On Mon, Oct 8, 2018 at 12:41 AM Stephen Ocaya <socaya@xxxxxxxxxxxxxx> wrote:
>>>>>>>>> Hello  Amjad M. Ata-Allah , Kindly share the condition expression for the program rule.
>>>>>>>>> 
>>>>>>>>> regards
>>>>>>>>> 
>>>>>>>>>> On Sun, Oct 7, 2018 at 10:15 PM Amjad Ata Allah <ataallah.amjad@xxxxxxxxx> wrote:
>>>>>>>>>> Dear All,
>>>>>>>>>> 
>>>>>>>>>> I am working on DHIS2 2.30 project.
>>>>>>>>>> I am trying to hide/show program stage depending on a user selection. I succeed to hide the program stage, but its not showing back.
>>>>>>>>>> 
>>>>>>>>>> Also there is no errors in the console.
>>>>>>>>>> 
>>>>>>>>>> Regards,
>>>>>>>>>> 
>>>>>>>>>> -- 
>>>>>>>>>> Save a tree, Please don't print this email unless you really need to.
>>>>>>>>>> 
>>>>>>>>>> Amjad M. Ata-Allah
>>>>>>>>>> _____________________________
>>>>>>>>>> M: +970.599.721.158
>>>>>>>>>> Em: ataallah.amjad@xxxxxxxxx
>>>>>>>>>> Em: amjad.ataallah@xxxxxxxxxxx
>>>>>>>>>> Skype: amjad.ataallah
>>>>>>>>>> _____________________________
>>>>>>>>>> _______________________________________________
>>>>>>>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>>>>>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>>>>>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>>>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Strategic Information Systems for Actions
>>>>>>>>> Plot 36 Impala Avenue, Kololo
>>>>>>>>> P.O. Box 4750, Kampala
>>>>>>>> 
>>>>>>>> 
>>>>>>>> -- 
>>>>>>>> Save a tree, Please don't print this email unless you really need to.
>>>>>>>> 
>>>>>>>> Amjad M. Ata-Allah
>>>>>>>> _____________________________
>>>>>>>> M: +970.599.721.158
>>>>>>>> Em: ataallah.amjad@xxxxxxxxx
>>>>>>>> Em: amjad.ataallah@xxxxxxxxxxx
>>>>>>>> Skype: amjad.ataallah
>>>>>>>> _____________________________
>>>>>>>> _______________________________________________
>>>>>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>>>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>>>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>> _______________________________________________
>>>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>> 
>>>>> 
>>>>> -- 
>>>>> *******************************************
>>>>> 
>>>>> Calle Hedberg
>>>>> 
>>>>> 46D Alma Road, 7700 Rosebank, SOUTH AFRICA
>>>>> 
>>>>> Tel/fax (home): +27-21-685-6472
>>>>> 
>>>>> Cell: +27-82-853-5352
>>>>> 
>>>>> Iridium SatPhone: +8816-315-19119
>>>>> 
>>>>> Email: calle.hedberg@xxxxxxxxx
>>>>> 
>>>>> Skype: calle_hedberg
>>>>> 
>>>>> *******************************************
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> -- 
>>>> Save a tree, Please don't print this email unless you really need to.
>>>> 
>>>> Amjad M. Ata-Allah
>>>> _____________________________
>>>> M: +970.599.721.158
>>>> Em: ataallah.amjad@xxxxxxxxx
>>>> Em: amjad.ataallah@xxxxxxxxxxx
>>>> Skype: amjad.ataallah
>>>> _____________________________
>>> 
>>> 
>>> -- 
>>> *******************************************
>>> 
>>> Calle Hedberg
>>> 
>>> 46D Alma Road, 7700 Rosebank, SOUTH AFRICA
>>> 
>>> Tel/fax (home): +27-21-685-6472
>>> 
>>> Cell: +27-82-853-5352
>>> 
>>> Iridium SatPhone: +8816-315-19119
>>> 
>>> Email: calle.hedberg@xxxxxxxxx
>>> 
>>> Skype: calle_hedberg
>>> 
>>> *******************************************
>>> 
>>> 
>> 
>> 
>> -- 
>> Save a tree, Please don't print this email unless you really need to.
>> 
>> Amjad M. Ata-Allah
>> _____________________________
>> M: +970.599.721.158
>> Em: ataallah.amjad@xxxxxxxxx
>> Em: amjad.ataallah@xxxxxxxxxxx
>> Skype: amjad.ataallah
>> _____________________________
> 
> 
> -- 
> *******************************************
> 
> Calle Hedberg
> 
> 46D Alma Road, 7700 Rosebank, SOUTH AFRICA
> 
> Tel/fax (home): +27-21-685-6472
> 
> Cell: +27-82-853-5352
> 
> Iridium SatPhone: +8816-315-19119
> 
> Email: calle.hedberg@xxxxxxxxx
> 
> Skype: calle_hedberg
> 
> *******************************************
> 
> 

Follow ups

References