Here I go through three tricks or hacks I use all the time when I am building Knack database apps. 1) A method to force equations or text formulas to populate; 2) A control on "delete" to prevent accidental deletes; and 3) How and why to drawn in parent fields into a child record. Please check it out.
Here's a related post that you might like: https://www.knackbuilders.com/post/text-formula-hack-for-knack-databases
Interested in my Knack database app services? ... Book a call with me here: https://calendly.com/daveparrish/callwithdave
0:00 Hey folks, Dave Parrish here with Knackbelder's doing another video. It's Christmas Eve and I'm actually cranking out one of these. 0:07 But let's get into my topic today. Three tricks that I use all the time. I mean, daily, on every app that I'm building, I'm constantly giving this stuff for a number of reasons. 0:16 I'm gonna tell you, all these I've probably mentioned in previous videos, but I wanna put some in one place. One trick is what I call update. 0:26 You update the record because you've made either an equation or a text. Formula drawing in from whether updates or even concatenating stuff within your own record. 0:41 When you first do that, sometimes it doesn't populate, but just sit in there blank. And you may need it to continue working. 0:48 Something else. Umm, there's a number of reasons. Or you just want to make sure it's right. And Mac's a lot better at this than they used to be. 0:57 Umm, but sometimes it doesn't populate. I'm going to show you a trick to force it to populate. Another one is a method I use for controlling delete. 1:06 Delete's a whole big topic. Uhh, there's a lot of different approaches to put control on delete. Umm, I'm going to show you what I do most of the time. 1:15 And drawing in a parent, uhh, field natively, meaning into a child. So it's there itself, it's not drawn. You may need this for, again, some control stuff. 1:27 You may need it for, uhh, doing emails, because emails only lets you access the fields that are within the record you're looking at, or the object you're looking at. 1:35 So let me jump into these, and this will help be too long. Thank you.
0:01 Okay folks, let's do this three tricks. The first one is this thing I called Update to get equations or text formulas to populate. 0:13 Let's just try this one. Invoid. Invoice. Invoice has a company that's being, that's on the invoice. And let's say you want the address of that company. 0:24 Well, in your views you can grab it, but sometimes you're gonna want, if you're doing an email especially, or some other things, you don't want it to sit there. 0:32 As an actual field, uhh, in your table. But let's just do one. Here, I'm gonna do this. This is test company at let's just go find the address. 0:55 Company pay address. Let's just put this here. Now when you first do it, I just made it. I'm gonna go all the way over. 1:04 Let me get out of here. See, it's blank. And you want it. Uhh, not sure if you did right. Uhh, you picked the wrong field. 1:14 But this thing I'm gonna do right now is gonna help put them on. Let's do update. You know, do it on all records. 1:23 And I just always have this field called update, solely for this, this use case. And it's just a text form, or a text field. 1:32 I can put anything I want into it. And when it runs, what it's gonna do is go through all the records. 1:37 It's an updated. And when it does that update, it sort of forces that thing to populate. The text formula, in this case. 1:44 So let's do that. And again, that's a lot better at this than it used to be. Come on, let's have it run. 1:55 Well, let's see, when we go over here, come on, run. Okay, so now it ran, now let's go look. Now, force it, now it, it has these. 2:22 So, I do that all the time, and it works out quite well. So, out quite well. We'll be right back.
0:00 Okay, let's do the second one here. Hide Delete is a control method. Here's the way I do it. Here's a customer home page, and that lists a bunch of invoices they've submitted. 0:11 And when, in practice, when you're doing this, you may create the wrong invoice and when I get rid of it, it might be a duplicate. 0:17 Uhh, so you want to give them the ability to delete, but you got, you don't want to delete the wrong stuff and make it too easy. 0:22 And here's how I do this. This delete button here, I put a rule on it. Let's get to it. Display rule. 0:32 And this is saying, hey, if the total of the invoice is higher than zero, hide delete. That means there are, in the detail pages of this invoice, there's line items that have been added. 0:48 And its chances are, you don't want to delete that one by mistake. And if you do, you gotta make it fairly intentional for the user. 0:57 So if it was, in fact, something they duplicated, they're first gonna have to go to the details of that invoice. 1:05 Delete the line items, umm, and then come back, and since there's no line items, it's not gonna have a sum, umm, and if it's, it'd be able to delete this. 1:19 So again, it's an intentional method.
0:00 Okay, the third one is drawing in a parent field to a child table and have it reside natively in the child. 0:08 One use case for this is emails. Emails only let you use the native fields. It doesn't let you grab connected stuff. 0:16 So if you need something that is in a parent record, you have to put it there and this is what you do. 0:23 Now let's go look at what I'm talking about today. This is this wrap-home. We're going to go to the details. 0:30 This is another control thing too by the way, but it can all come into use cases. Now we have an invoice and it has a status and it has another field that is driven off the statuses by conditions that says, hey, can the email or can the rep edit this or not. 0:48 The records and the status and that field with the parent record, the invoice, it doesn't sit there in the child records, which are expense line items, but right now they have the ability if they're still working on it. 1:04 They haven't submitted it to edit this, but once it's submitted and surely once it's paid, you don't want them going back and changing stuff, so you want to put a control on that. 1:13 We go to edit and, well, I'll do it over here. I'll use delete. Again. So, this same field allow, I call it drawn in, allow to edit, drawn in meaning it's from the parent record it's sitting there, and if it's no, it's going to hide this value because once it's submitted you don't want them to, to delete 1:44 the end, or the line item, umm, and the same with edit too, same thing. Umm, you can either hide, . This, ability to edit, uhh, based on that drawn in value from the parent, or a note can pop up, you can put a page rule on this, and a page rule you can do uhh, related fields, but this is, Thanks for 2:09 watching! You could say, hey, this has been submitted, you can't edit, umm, so there's, it hides the view that, then you have it show a message. 2:17 So those things I use, I'm telling you all the time I thought I'd put them together here for ya, and Merry Christmas, thank you!