Advanced Condition broken?


Userlevel 3
Badge +16

It seems my Advanced Condition is broken....

 

It is a simple Advanced condition to check two text fields:

 

1 Text field 1 "IS NOT EMPTY"

2 Text field 2 "IS NOT EMPTY"

 

With an OR expression

 

I then for example want to display a message (as a test)

 

The message is not appearing when either or both have data....

 

This is reaaly annoying because the Advanced Condition should allow me to check multiple values and THEN do Something.

Because this is not working. I have to duplicate my Do Somethings multiple times because I have to do a single condition check as a workaround.... As u can imagine, the Rule is huge now....


16 replies

Badge +10

Sharpharp1,

 

Is this rule set on the view or the form?  I'm currently trying to reproduce.

 

Regards,

 

Mike

Userlevel 3
Badge +16

Hi Mike,

 

This rule is created on the Form, but is to do with the item view.

Badge +10

So just to fully verify this.

 

Two text fields on view.

Advanced condition rule from form level.

Button (form level?) checks whether fields are empty, if one of the fields is empty, display message to user.

 

I'm going to try and recreate now in this fashion, let me know if my assumption about the button is incorrect.

 

-Mike

Badge +10

I'm back, and having both tested the solution and re-read the question, I believe I have the answer.

 

Let p = IsNotEmpty(text1)  - will return the value True if something is typed into text1.  False if nothing is entered

Let q = IsNotEmpty(text2)  - will return the value True if something is typed into text2.  False if nothing is entered

 

Going back to my favorite subject, discrete math, here is the truth table for the OR function

 

 

pqp  q
TTT
TFT
FTT
FFF

 

 

Therefore, if something is typed into either box, p or q, or if something is typed into both boxes, the function will evaluate to true.

 

Here is the truth table for the AND operation

 

pqp ^ q
TTT
TFF
FTF
FFF

 

Perhaps that is more the behavior you are looking for?

 

I should also mention that you will have differing results by removing the negation (IsNotEmpty vs isEmpty), essentially reversing the values for p and q:

 

Let p = IsEmpty(text1)  - will return the value True if NOTHING is typed into text1.  False if something is entered

Let q = IsEmpty(text2)  - will return the value True if NOTHING is typed into text2.  False if something is entered

Userlevel 3
Badge +16

My advanced condition is TRUE if either the conditions (with OR) are "IS NOT EMPTY" then bring up a message box (i.e. if there is data in any of the fields)

 

So the condition is correct, but the result in wrong, as no message box pops up.

Badge +10

We have a disconnect somewhere then.  I just tried it with K2 4.6.8 and Smartforms 1.0.7 on my VM.

 

Can you let me know what versions of K2 and smartforms you are using, along with perhaps a screenshot of your rule configuration?  Also, is your button defined at the form level or the view level?

Userlevel 3
Badge +16

Hi,

 

 I am using the latest versions of k2 and smartforms, same as you.

 

Ok, let me explain a bit better, here is how its setup:

 

On the form, it has a rule - When Item View - My View executed Initalized

 

In the rule definition:

 

When the Item View executed Initialized

If an advanced condition is true

 then complete the following one after another

 Send a message to screen (for example)

 

In the advanced rule it says:

 

1) If text box 1 is not empty

2) OR text box 2 is not empty

 

I populate records using a SAVE METHOD and then pass a parameter to the form with an objectID. This Object ID then loads the record upon loading.

As soon as the record has loaded, that when my Rule kicks in.

 

I have also done a test project and set all this up from scratch and that works fine. So it looks like something has broken the Advanced Rule in this particular project. The only thing i did was delete a text field used in the advanced condition from the Smartobject (because it was no longer needed) but it was referenced in the Advanced condition. Once the field was deleted from the SMO, I then edited the advanced condition to remove the BLANK field (as it no longer existed) from the advanced expression and saved it and Checked in the form/view.

 

Since then it hasn't worked. So seems like a bug that if you delete the field from a Smartobject which is being used in an Advanced Condition, then try and use the Advanced condition, it no longer works....

 

So i'm very puzzled by this. I can't start my project again because it has taken me months to build, and now its not working because of a simple Advanced Condition which checks to see if two text boxes are not empty -and no longer works :-(

 

 

Badge +10

Trying to figure out exactly how you have this rule configured.  Could you post a screenshot of the rule configuration you currently have for the form?   Something like this:

 

15586iFAE456561DB385FB.png

Userlevel 3
Badge +16

Here you go Mike, blotted out the item view name

 

13012i74CBB9217D766238.jpg

 

It really is straight forward, but the advanced condition appears to be broken.

No matter what I put in that advanced condition, be it with an AND or an OR to check if a text box is empty OR even not empty, it will not bring up a message (or any other settings i try like show a control)

 

Thanks Mike for your help thus far

Badge +10

Alright, I'm going to post the steps I did to recreate this issue, and hopefully find the solution.

 

I started by creating a smartobject with 4 total fields, an ID(autonumber), and three text boxes.  I added four entries to this with varying degrees of completness.

 

14905i8C2401A214E15350.png

 

Now that we have a smartobject, I created a view:

 

11410i8BEA06C2AC77E024.png

 

So thats good, rules are configured so that the load method is fired based on a parameter passed to the view.

 

15783i4C8D740FD4EC85FF.png

16539iE3BF459491C71DC0.png

14847i1B3E653A54839A0B.png

14542iA79797F05B4978A4.png

 

Ran the view with "3" as the parameter and got expected output:

 

13581i5FB51BE7EA0C2021.png

 

So that's good, now off to the form.  The form is literally the exact same as the view, just inside a form with form level rules on it, also having a parameter named "ID".  I'll spare the pictures there, but the rules:

 

12280i41F49F5DBEFF5A83.png

 

Now, there are three rules.  Unfortunatley, I named my form the same as my view when I created it which obsfucates things.  The top rule in the list is the one inherited from the view.  We are concerned with the two below it.

 

Rule 2 is the "important" one.  This fires your message.

11316i61ED5CBD7E3300C2.png

16924iBAF42A58948CC9F5.png

 

Rule 3 just makes sure the parameters get passed around appropriatley to initialize the view, this i believe is 95% automatically generated.

 

11104i872B2912260D0BC7.png

 

 

Alright, I believe that is the steps you took to get to the base, "everything works" state.  I added another blank entry to my smartbox object (ID:5, breed:Null, Country:null, Pattern:null) to test the condition.  The condition does not fire in this case.  The condition works as shown for all other smartbox entries.

 

13542i4DAC12A4F58A6F96.png

 

So now we go ahead and try to break it by deleting "Pattern" from the smartbox smartobject.

 

13615i210732BCF19EF083.png

 

Edit the form rule advanced condition...

 

12261i0D060B16B1BBD79C.png

 

At this point, I'm going to go ahead and attempt to run the form with everything else still in place, including the "pattern text box".

 

12317i92D669026EED3567.png

 

So at this point, it's working in my environment despite the steps followed.  Can you check what may be different in your setup or rule configuration from what I did here and let me know so I can reproduce it?

 

 

 

 

 

 

 

 

Userlevel 3
Badge +16

Hu Mike,

 

Firstly thanks for going to this much trouble to try and replicate the issue.

 

I had it pretty much the same as you. As i recall, this is the sequence which broke it.

 

Initially all was working, advanced condition with 3x Text Fields all with OR between them saying IF NOT EMPTY, do this.

 

1) Customer no longer wanted one of the Text fields

2) I remove the field from the View

3) Red exclamation marks appear on the Rule with the Advanced condition, so I go into the Advanced Condition and notice the removed field is replaced with a blank box (in the advanced condition) so i remove the extra line and SAVE.

4) I run the Form and my rule is no longer working

5) I then delete the field from the Smartobject and run the form again, and still broken.

 

I also created a quick project from scratch with these OR rules and that works ok.

I can't re-do my original project again because their is simply too much work involved, I need to get this advanced condition working,

 

Thanks

Userlevel 3
Badge +16

For info, I fixed this by deleted the entire Item View and creating a new one from scratch and this time the Advanced Condition workded with two text fields with an OR.

 

Incidentally, K2 acknowledge a bug with the advanced condition, which means if you have a Date with an Text Field using an OR, it does not work. So its something that should hopefully be fixed in the next release.

Badge +2

I am having the same issue with the advanced condition, did you get it resolved?
I am using Blackpearl and smartforms on 4.7 with the latest CU from May 2017.

Badge +2

I think that my issue is being caused by an expression which is on the text box being validated for IsEmpty
I have seen then issue before with conditional formatting, where k2 treats an expression as a value even if the expression evaluates to BLANK

Badge +2

Is Not Empty is not working on a textbox which contains a Decimal type, even when blank, K2 is storing a 0 and the IsEmpty and Length functions read this as NOT EMPTY and a length of 1

Not sure why there is then need to store a 0 in the textbox for a decimal / number.

Userlevel 3
Badge +9

Hello Mike,

 

Are you using the smartbox smartobject? check what value is getting stored in SQL column. By default, it might be 0 for int column and you might need to change the default to null.

 

Reply