top of page

Fun with Conditional Rules #1 in Knack apps

Updated: Oct 17, 2023

Adding conditions to fields to automatically set their values is super powerful tool Knack has for your apps. There is an infinite number of things you can do with them ... as clever as you can get. This is the first in series of videos I will be doing on this topic, each showing a particular way I used conditions to accomplish something. I hope you enjoy it.

Interested in my Knack database services? ... Book a call with me here:

If you are a fan of building great apps with Knack, please click the Subscribe button to join my channel, and ring the bell to receive notices on all my new instructional videos. Thanks!

Full Transcript

hey folks Dave Parish here with Knack

Builders doing another video if you like these

please like them on YouTube and

subscribe to my channel but today's

topic fun with conditional rules

um conditional or fields that you can

apply conditions to and change their

values uh a really interesting and super

powerful and you can do all kinds of

thing I'm not going to try to break down

different things you can do that sent my

attempt here I just think they're really

cool I have a lot of good use cases of

how I put them together and so I'm going

to do a series of just different things

I've done this is the first one

um and just real briefly for conditional

rules on any field you can go to it and go to conditions

and add a condition and you can do all

kinds of things again but basically you

can set its value to other values so you

can do a whole bunch of combination of

things every field type might have different criteria that

allows you to do different things and

I'm going to give you an example of one

I recently did saved a lot of time thanks


okay I'm back and let's just jump right

into this go through a

conditional rules thing here here's an

app it's an invoicing app

and this is the table or the object

invoices and invoices have a status

and we have several statuses

they haven't they're working on it they

haven't submitted it they submitted it

it's under review it's been approved

uh in some cases something isn't right

and they sort of put it on hold throw it

back to the people that created the

invoice and have them do something and then

finally it's paid now here's the deal

uh remember these different statuses

here's an example of an invoice and its

status is not submitted yet

and when it's not submitted yet

they the person created it

uh that or still has the ability to edit

uh edit the invoice itself edit the line

items delete line items add more line items

and then finally submit it once they

submit it this makes sense they don't have the

ability to change anything

all these are done by page rules mostly and

when they also when it goes on hold we

want them to be able to edit it too but

all these other things

statuses we don't want them to edit and

the way we do that is Page rule that

hides it and shows a message if they

click on edit it's going to say you

can't add a dispenser a minute uh and

different things like that and this is a

page world that will just hide these

um but here's the issue I had and

there's a bunch of places we got edit we

got these two things we got edit here we

got delete all these have to be dealt

with with rules and if you know anything about how

you set rules with knack

in this case where you're setting

these page rules it doesn't allow and or

or all any it's just all and

and I can't create a condition that is

not submitted yet and on hold

you can't beat both of those at the same

time now experienced Builders know what

I'm talking about it's difficult to get

around that I would have to create for

every one of those several places where

we're gonna disable the ability to edit

or do things I'd have to make a rule for

each one of these is it this uh hide or

not hide is it that height or not hide

all so there's six of these and I got

four or five places so I'd have to do a

whole bunch of rules

I made this a lot easier with

conditional rules I'm going to show you

right now let's go to this

all right here's our invoice status

right we got all these different things

down at the bottom

I made a multiple choice and when I do

behind the scenes things mean it's not

really something someone's filling out I

put an asterisk next to it

this is allowed we're up to edit

multiple choice and it's a simple yes or

no that gives me one thing that I can drive

all the page rules not six different

things and then I made a condition

for each of the six if it's not

submitted they are if it's uh

submitted no okay so I had to do this

six times but I didn't have to do it six

times in five different places uh so

this gives me for all these ability to

do that and I'm going to go over

I'll show you what I did

here's the ability to edit

here's that ability now here's the page

rule foreign basically it's it just gives me

this one thing is rep allowed to edit no if it's the

answers no depending on the status it's

gonna hide this thing ability to edit

and it's also going to show this message

and point and what's going to be uh

edited now I might approach it slightly

different depending on where where I'm

doing things and

so that's that saved a lot of time and

it really easy if you know what you're

doing with those rules a note here too

expense line items so we have the parent

which is the invoice and then individual

expense line items

I can't grab that value sometimes

that lets you get to related values in

this case it doesn't each line item

I won't have access to that thing I made

the yes no but I can draw it in I just

use a text formula

went up to the invoice the parent record

said hey grab that yes no are they able

to edit put it in natively in this line item

record and that allowed me to capture and then

I can set a role based on that

same thing with the edit

the edit uh if it's no it's going to

hide delete so they can't delete it so

once they've submitted it and it's not

on hold they don't have anybody to

change it because we don't want them to

that's all I got that's a use case and

I'll have others thanks.

13 views0 comments


bottom of page