← Back to team overview

dhis2-devs team mailing list archive

Re: Program rules issues/questions

 

Hi Olav,
if you take the latest for 2.20 the form should behave like expected when several rules is hiding the same field.

R19893

Best regards,
Markus

> 22. sep. 2015 kl. 15.52 skrev Markus Bekken <markus.bekken@xxxxxxxxx>:
> 
> Yes, good - will implement this way. As you started at - this approach is also how warning and error messages is working, and a "hide if ANY" approach will be the most equivalent to the other action types.
> 
> Markus
> 
>> 22. sep. 2015 kl. 15.40 skrev Olav Poppe <olav.poppe@xxxxxx>:
>> 
>> Hi, thanks for the quick response. That explains why I was seeing strange behaviour. 
>> 
>> Might perhaps be different for other types of actions, but for hiding I think what you suggest would be the best, to hide if ANY rules want to hide a field (that was what I assumes it would do).
>> 
>> Regards
>> Olav
>> 
>>> Den 22. sep. 2015 kl. 15.22 skrev Markus Bekken <markus.bekken@xxxxxxxxx>:
>>> 
>>> Hi again,
>>> in cases where several rules affects the same dataelement in the user interface, it is currently the rule that is executed last that wins. To fix this, we have to decide on a way to resolve such inconsitencies, and I think the best way of resolving is that we hide the dataelement in case ANY of the rules want to hide it. 
>>> 
>>> As a partially related note: There is support on the way for prioritizing which rules that should run first.
>>> 
>>> Markus
>>> 
>>>> 22. sep. 2015 kl. 15.12 skrev Markus Bekken <markus.bekken@xxxxxxxxx>:
>>>> 
>>>> Hi Olav!
>>>> Thank you for the report and feedback. Do you have several rules that hides the same field/dropdown?
>>>> 
>>>> The disable option is a good idea. Will add this.
>>>> 
>>>> Markus
>>>> 
>>>>> 22. sep. 2015 kl. 14.30 skrev Olav Poppe <olav.poppe@xxxxxx>:
>>>>> 
>>>>> Hi devs, 
>>>>> trying to set up some program rules for an Event program in 2.20 (rev 19876) in a custom form, with mixed results. 
>>>>> 
>>>>> 1)
>>>>> Expression: {DropdownA} != 'Yes'    (also tried !{DropdownA} || {DropdownA}!='Yes' )
>>>>> Action: Hide field {dropdown B}
>>>>> I.e., unless dropdown A = 'Yes' dropdown b should be hidden/disabled. 
>>>> 
>>>>> 
>>>>> In data entry, dropdown B is never disabled. However, if I enter a value for both dropdowns, then change the value of dropdown A to something other than 'Yes', I do get a warning that dropdown B will be cleared. So the rule expression seems to be right, but it is not disabling the field.
>>>> 
>>>>> 
>>>>> 
>>>>> 2) 
>>>>> I have a four rows, each with a dropdown (diagnosis) and a checkbox. There can be diagnosis on 1-4 rows, but only one checkbox can be checked at any time. So I made a rule that says {checkbox A} => hide/disabled checkbox B-D, if checkbox B, disable A, C, D etc. 
>>>>> 
>>>>> In data entry, if I check box A, B-D is not disabled. If I check B while A is also checked, it will first tell me that B will be unchecked because A is checked, then that A will be unchecked because B is checked - with the result that both become unchecked!
>>>>> 
>>>>> 
>>>>> Writing this up, I realise that in both case 1 and 2, the fields in question are also included in other rules. Could it be that only one program rule is applied to a field at any time? It would be a very big limitation if that is the case. Testing a bit further, it might even look like it is applying the rules somewhat randomly for fields that is mentioned in multiple rules.
>>>>> 
>>>>> 
>>>>> As an additional point, I think it would be great to both have "hide" and "disable" actions, and that with the "disable" action you could chose whether to clear the values of disabled fields or not.
>>>>> 
>>>>> 
>>>>> Regards
>>>>> Olav
>>>>> _______________________________________________
>>>>> 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
>>>> 
>>> 
> 



Follow ups

References