Description

Use a simple strategy for adding or entering data to the database through the use of a popup window.

Video recorded using: Ignition 7.7

Transcript

(open in window)

[00:00] When it comes to entering data into the database, the easiest way to go about this is to create a pop up window that acts as an entry form. I'll be using a pre created window that I'm showing here, as well as the window that I created in earlier video. This pre created window has all the necessary components for the Add window. Let me go through them. This text box will hold the name, a drop down box for the location that I've bound to a sequel query that will bring back the distinct locations for my inventory table in my database. A description box which will hold the description for the item, the quantity of the item, and then these two buttons over here. The Add button is where all the work on this window's done. So let's go ahead and open this up and put in a script. The script goes on the action performed. And we'll move over to the script editor. I'll paste in the script that I've written here, and go through this with you. What I'm doing is creating four variables to hold the data from the components on the window that I want to pass to my sequel query. I have name, location, description and quantity. Right here is where we're actually adding the data into the database. We're going to do a system.db.runPrepUpdate, and I'm going to pass it to my query, which is insert into inventory, name, location, description, quantity. Those are the column names that are in my table, and values followed by these question marks right here. These question marks will get populated with my variables over here in the order in which I list them. Finally, I'm going to close the parent window because again, this is acting as a pop up window. We go Okay, we go to the Cancel button. And let's just make the Cancel button close the window, essentially doing nothing. Go Close, Okay. And now let's go ahead and test this out. Put some test information in here. We'll go test or if I wanted to, I guess I could choose plant floor or front office floor, just going to go with test. Test here, put in 15 for a quantity, and let's go ahead and add committed. And now you can see that the test row has add and come up in my database table.

You are editing this transcript.

Make any corrections to improve this transcript. We'll review any changes before posting them.