Skip to main content

Hi,

 

I'm trying to build a Ruke which is supposed to check a row of 4 controls to see if any are empty, if any one of them has a value then do something.

 

But when building the rule, I can only get the following:

 

When the View executed initialized

If control1 contains a value

AND control 2 contains a value

 

Instead of the AND, how can i use the OR function, it wont let me change the AND to an OR.

 

Thanks in advance

What you want to create is an "advanced condition".

 

12343i29757247C8C7F6EC.png

 

When you configure it, you have complete control over the process, along with the option for "OR"

 

16830i05FE98D7DEC73395.png

 

In your case, click the add button 4 times at the top, switch all operators to OR, and drag and drop the appropriate controls from the context browser.


Thanks Mike, i'll have a look at this later next week.

 

Thanks again!!!


Hi,

 

Tried this and it doesn't work for some reason:

 

16857iB32A72B8CC5B0F6B.jpg

 

Also tried the Is Not Empty Operator and that also does not work with four items with ORs inbetween.

 

It should work. I say in the rule to check these four fields. If any of of the 4 fields are NOT Empty then make the next row visible, but its not doing this.

The result would be advanced rule is TRue, therefore make the next row available...

 

If I do the above advanced rule with just one field it works. I have set it up so two of the above fields have data in them to test this, but no joy.

 

Any ideas?


Did more testing and this is bizarre...

 

It will work if I use UP to 3 fields. If I use a forth field in the Advanced Rule with the OR expression it simply does not work,,,


Hi,

 

I'm working with k2 on this issue, but it would help if anyone could try the following and post your results:

 

Create 3x String Fields and 1x Date Field.

 

Create a form/Item View with a Rule as follows:

When Item View executed Initalized

If an advanced condition is true

then change the properties of a Text box to become Visible (just so you know if it works or not)

 

In the advanced condition, add all 4 fields and put Operator "Is Not Empty" and use OR as the expression between all of the fields

Had a button to save the Data back to the SMO.

 

Now run the form and please let me know the results.

 

I feel that their is a BUG, because no matter what you put in the 3x String fields, it will not make the Text Box Visible. If you add a value to the Date field, then the Text Box is Visible.

 

It is as if the OR expressions are bypassed when you have the Date Field in there with the String fields using OR statements....


Attempted to reproduce, but cut out the smartobject for simplicity's sake.

 

Set up 4 text boxes, one set to date/time. On the form, I've created an advanced condition with 4 fields and 3 OR's.  Displays a message to the user if all fields have something in them.

 

Mine is currently working correctly and displaying a message to the user if the fields are populated.

 

I went ahead and configured the form rules as such:

 

13171i9138EC01FA56B374.png

 

And as soon as I click the button, my hidden fields appear.

 

11308iD003424FDB108929.png

 

Remember, "When the View executed initialized" only happens once in the form, when it is first loaded.  Your users are not going to be able to input anything into the form before it's displayed on the screen, so your condition is checking if an empty form is not empty.

 

What I think you are looking for, is an "Add Row" button, that checks and makes sure all available rows are filled up before it allows the addition of another set of fields.

 

Edit:  I'd also like to discourage you from using anything similar to "When XXXX is Changed" to trigger the addition of more fields. That logic would look like:

 

When Box1 is changed, or Box 2 is changed, Or Box 3...

     if advanced condition is true (same condition as previous)

 

The danger here, is now, every time a user changes something on the form, the system is going to have to check if all the fields are empty.  I'm envisioning 100 users trying to enter data on a form and triggering 4 seperate checks whether all fields are empty.  Now lets say 50 of those users have to add four items in.

 

100 users x 4 "checks" = 400 checks

50 users x 8 "checks" (2 entries) = 400 more checks

50 users x 12 "checks" (3 entries) = 600 more checks...

 

I think it's obvious where this is going.  Perhaps you could avoid recursivley checking all the fields, but even then, you're still going to be running a ton of checks that may not be needed.

 

Edit2: There may be another way to do what you're looking to do here.  This post gave me the idea.  http://community.k2.com/t5/K2-blackpearl/Adding-a-subview-to-a-form/m-p/72284#M20753

 

Another approach I just thought of thanks to that post is to use a list view at the top hooked to a smartbox object for "temporary" storage.  When the user adds an individual entry into the item view at the bottom, have it added to the list view at the top and clear the bottom item view.  Once user is done entering all thier entries, they can commit them to the "real" smartobject in a batch.


Reply