Fun with Conditional Rules #3 (fix a corrupt field) with a Knack Database App
Here is another use case of using conditional rules in a Knack database app. These are great. This time I'm addressing a corrupt field (it no longer works) and using a conditional rule to fix it ... well, sort of, but it gets the job done. Check it out.
Interested in my Knack database services? ... Book a call with me here: https://calendly.com/daveparrish/callwithdave
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!
Hey folks Dave Parish here with that color is doing another video for you today's topic again if you like these videos please uh like Amanda YouTube channel And subscribe to the channel also but I'm gonna do another one on conditional rules I love conditional rules so I'm I have this series whereI just say hey here's how I use the conditional rule to solve something in this case what I'm going to do is solve a corrupt field and if you build a lot every once in a while it doesn't happen that often the field that you had like an equation in this case it's a an equation uh but it could be something else it just stops working it's done and that field can be used in a whole bunch of places uh for other things and it's pain and you don't have to redo a whole bunch of stuff I'm going to show you a way to greatly minimize the hassle of the corrupt field using a conditional ruleI'll be right back okay here's the lowdown now I use the conditional rule to fix the corrupt field I'm going to call up an amp here this is going to be short one this is an amp it's for swimming school it manages a bunch of aspects of it creating a class location a pool an instructor students parents sign up there's their kids for a particular class manages instructors of the class and each class with a bunch of different types of class has a bunch of questions or skill sets that they're rated on depending on the type of class they each have a different set and then all these different skill sets are added or the scores are added together and they have to reach a certain threshold to pass the class in advance on to the next class A lot going on with this but this has to do with an equation that's adding up a bunch of ratings for a particular class and there's a whole bunch of this in one table student class thing is what an instance of a student taking an incidence of a class and all different classes are in the same objects and using page rules it either shows the appropriate content depending on which class but we're dealing with the somewhere that some of the ratings I don't want to call I'm just going to call it here's different things these are acronyms and these are all behind the scenes by the way but it's taking the scores adding them up all the ratings that they got for these different types and this one right here called SK final and this used to be an equation and like I said doesn't happen that often but it's definitely it happens that this field just stops working I rated one of the kids testing this and it used to work and then it was resulting in the score of zero and it's a simple calculation give you an example another one it's just taking the whole score into dividing it by the maximum I don't get into the how we're rating it times it by 100 so it's not a decimal and then adding back a manual adjustment if you want to do a manual adjustment this is what this was it was giving me the right answer that stopped and then this particular thing is used in a number of different places used to calculate something else it populated throughout the app and the admin side instructor's side and I didn't want to have to I could have remade it but then I have to go back to all these other places and change it I don't want to do that what I did is first of all to find out if it was corrupt it made the exact same field and then I copied its content which was this but adding up different things just simply copied it this thing here with the asterisk goes doing it behind the scenes I put an asterisk this I did call this test and then I let it do its thing and it gave me the right calculation and I'm like ah man this thing's corrupt and again I didn't want to have to do it in a whole bunch of places so then I said you know what why don't we just use a conditional rule what I'll do is I'll make this I'm going to call this fix and I explain exactly what it is uh this other field got corrupt so I'm going to use this field that I know is working and I'm going to make the corrupt field the value of this field that's the gist of this whole thing I'm talking about so what I did is take this equation that was corrupt not working anymore turn it into a number change the type of field and it gives you a warning you can lose everything I don't care so now it's a number field then I put a condition on and I said heyI want this field to be the value of this other exact same equation but the one that's working and I called it renamed it to fix and that's what it did so now this score is whatever this value is and you should by the way it's best if you have a condition have this before the one that has a condition so this value is set then this goes and grabs it you don't want to do it the other way around I think it might work itself out but put it before there's an order of operation so by changing this and just making it the right value that I already had I don't have to go into all these other first of all there's other equations that use it that I have to go now fix it's remaining the same field as just right now and and then I don't have togo to the pages side and hunt all around for where it shows up and replaced replace it I just leave it at the same one I just got it pushing it to work using that conditional rule that's what I got today folks appreciate it thanks