If Conditions

For HanDBase related topics that are not specific to one platform.

If Conditions

Postby Reggae » Thu Mar 18, 2010 8:56 am

Hi,

Is it possible to nest IF conditions within the same field formula?


Thanks


Reggae
Reggae
 
Posts: 26
Joined: Tue Oct 06, 2009 3:37 am

Re: If Conditions

Postby dhaupert » Thu Mar 18, 2010 12:18 pm

Hi,

You can't do more than one compare in a field, but you can chain them together. A lot of users have done that in their designs. Let me know if you need an example to see it in action.
dhaupert
 
Posts: 4111
Joined: Tue May 26, 2009 11:51 am

Re: If Conditions

Postby Reggae » Thu Mar 18, 2010 12:27 pm

Hi Dave,

Great and yes an example would be great.


Thanks


Reggae
Reggae
 
Posts: 26
Joined: Tue Oct 06, 2009 3:37 am

Re: If Conditions

Postby dhaupert » Mon Mar 22, 2010 10:17 am

Here's an example of how you could do this. Let's say we wanted a conditional field to be set to 'Valid' if a few fields meet a set of criteria or Invalid otherwise.

Let's say these fields are a date field named DOB, a checkbox named 'Signed form', and an integer field named 'Quantity Ordered', and let's say a record is only valid is the date of birth is set to something other than No Date, the checkbox is checked, and the integer field for quantity ordered is > 0. Here's how we'd set up a chain of conditionals:

Conditional field named 'DOB Valid' set to not visible in Edit record or list view. Condition is this: If DOB is not equal to 0 (value for No Date) output is 'Valid', else output is 'Invalid'.
Conditional field named 'Signed' set to not visible in edit record or list view. Condition is: If Signed form is equal to zero (value for unchecked) output is 'Invalid', else output is Field named 'DOB Valid'.
(Notice how instead of setting to valid for the above we look at the previous fields' value, so we can chain their dependencies together).
Lastly, a conditional field named 'Is Valid' set to be visible since this is the final part of the chain. Condition is: If Quantity ordered is greater than 0, output is Field Named 'Signed", else output is 'Invalid'.

If you try this out with a test database you should see the expected behavior and can hopefully modify this to your needs!
dhaupert
 
Posts: 4111
Joined: Tue May 26, 2009 11:51 am

Re: If Conditions

Postby Reggae » Mon Mar 22, 2010 11:34 am

Many thanks for the example - that's a lot clearer now. I'll give it a go.

Best Wishes

Reggae
Reggae
 
Posts: 26
Joined: Tue Oct 06, 2009 3:37 am

Re: If Conditions

Postby Reggae » Tue Mar 30, 2010 7:35 am

Thanks that worked great.
Reggae
 
Posts: 26
Joined: Tue Oct 06, 2009 3:37 am


Return to HanDBase General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests