Jump to content

Override Flag condition not working


Recommended Posts

Hi

I have a Custom Form in an IC that has multiple Form Fields within it that have override flags configured so they are visible only if other questions are answered. Some of these questions are on the previous Custom Form and are therefore selected accordingly in the override flag conditions. I can't however get one of the conditions to work (see highlighted on the attached). 

The first condition is based on a question in the same form so works fine. The second condition is based on a question in the previous form and still works fine, but although the third condition is based on a question in the previous form (i.e. the same form as the second condition) the override flag for this condition is failing. I have checked and I am pulling in the correct answer.     

I wondered if it was due to the second condition not being answered and therefore being an empty string but surely the whole point of the 'OR' is to cater for that?  I'm sure I've also got other similarly configured override flag conditions that work ok.     

Any ideas?  Thanks, Sam

image.png.322bb8aaaa346a26a3d715c52208b28d.png   

Link to comment
Share on other sites

Hi Sam,

I don't have a definitive answer, but my suspicion is that the way these are grouped together under a single condition, the logic between AND and OR may be the cause of the problem. 

When I look at this, I'm unsure of the order of the operations.  It could be one of the two, which may produce completely different scenarios: 

(Remote Working AND Equipment Required) OR Equipment Required

Remote Working AND (Equipment Required OR Equipment Required)

An alternative approach could be to create multiple Override values, rather than trying to put it all into one.

image.png

Link to comment
Share on other sites

On 7/21/2022 at 10:59 PM, James Ainsworth said:

create multiple Override values

This.

On 7/21/2022 at 10:59 PM, James Ainsworth said:

I'm unsure of the order of the operations

The original expression is: Remote Working AND Equipment Required OR Equipment Required

This combines two different logical operators that have an order of precedence. The AND operator is evaluated before the OR. Therefore, without any brackets to group criteria, the above becomes:

(Remote Working AND Equipment Required) OR Equipment Required

So what the system will do, it will evaluate first the: "Remote Working AND Equipment Required". The result will be a Boolean value: true/false. The next bit, will be evaluating the remaining expression which is the result from the first evaluation OR Equipment Required. Because we have the OR operator here, if the result from the first (AND) expression is True, then the whole expression will have the Boolean value of True. At this point it is irrelevant what value is returned by the last criterion because the "AND" expression is True. I can see this being slightly confusing so another way to look at the above is with the value for each criterion:

Remote Working = True/False - let's say it evaluates FALSE

Equipment Required 1 = True/False - let's say it evaluates FALSE

Equipment Required 2 = True/False - let's say it evaluates TRUE

Let's combine them without brackets:

FALSE AND FALSE OR TRUE. As explained above the AND is evaluate first so we now have: FALSE OR TRUE. The result of the whole expression would then be: TRUE.

Let's combine them with brackets for the AND:

(FALSE AND FALSE) OR TRUE. The AND being in brackets is evaluate independently so now we have: FALSE OR TRUE. The result of the whole expression would then be: TRUE. This is the same result as with not using brackets which explains how AND precedence works above.

Let's combine them with brackets for the OR:

FALSE AND (FALSE OR TRUE). The OR being in brackets is evaluate independently/first so now we have: FALSE AND TRUE. The result of the whole expression would then be: FALSE. Now you can see the grouping the OR to be evaluated independently, basically before the AND, produced a different result for the whole expression.

 

 

Assuming you need to condition to work as "the override should work when Remote Working is set (as Yes or True) and (or in combination with) when I have the correct value for either Equipment Required 1 or Equipment Required 2, so one or the other). If this is correct as in this is how you would need this to work then you would have two conditions:

1. First condition is where you have "Remote Working is set" AND "Equipment Required 1".

2. Second condition is where you have "Remote Working is set" AND "Equipment Required 2".


Here is another post explain the logical operator precedence in expressions: https://community.hornbill.com/topic/9972-issue-with-analytics/


EDIT: updated how the conditions need to be set. The way multiple condition work is:

1) evaluate the first condition in the list
2) if true then apply it and FINISH (ignore any other condition in the list)
3) if false move to next condition and repeat

Link to comment
Share on other sites

Update, the following split still didn't work:

1. First condition is where you have "Remote Working is set" on it's own.

2. Second condition is where you have "Equipment Required 1 or Equipment Required 2" grouped together on their own.

 

I therefore had to split the 2 override flags like this to make it work:

1. First condition - "Remote Working is set" and "Equipment Required 1".

2. Second condition - "Remote Working is set" and "Equipment Required 2"

image.png.51a29c502f444ecd7cfede3bdf107b73.png

image.png.5ebbf69b334ae2057d6b495888b23817.png

Hopefully this is all good now

Sam 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...