Applab Data coding


I am going to assign the Post AP Data tools 19-20 to my students, but before that I wanted to test it out and see the program. It is really good. I decided to do a quick app of what I will get the students to do at the end of the semester.

I am not sure if the code is correct, as I have a yellow triangle. Otherwise it works and I can see the data.

Here is the app I quickly built:

@e.fat The yellow triangle usually indicates a warning, such as an unused variable.

You don’t need the record parameter to the function expression because you don’t use it.

Thanks for that, but why don’t I need it exactly?

Though is the code correct?

I have added a new column in my table where the user selects its Gender. However when I code and check my data it does not work properly. When the user selects their gender and type in there favourite food, it should be appear on the data in one row, however it appears in two.

As an example:

Favourite Food: Gender:
Pizza Male

I want it to appear like this, but can’t seem to work it out.

You don’t use it within the function you have defined. So you don’t need to pass it as a parameter.

The code is correct. App Lab uses something called a lint remover. What that does is look for possible mistakes. Not using a parameter is a possible mistake so you get a warning. It isn’t an actual error.

It does what it is coded to do, but you coded it to do something you don’t want. It happens more often than you think. There is no error.

What it does is have two ways to create a record in your database. One way is to change the gender drop down. That puts a record into the database with the value male, female, or Please choose one. Foodtype will be undefined.

The second way is to push the Next button. That creates a record in your database with foodtype set to whatever is in txtinput. Gender will be undefined.

I suspect what you wanted is to have only one way to create a record with both gender and foodtype set. The way you would do that is to remove the onEvent from dropdown2. Change the onEvent for the button to test if there is a valid value in dropdown2, meaning not Please choose one. You could also check to see if txtinput is not blank. If so then create a record with both the dropdown2 and the txtinput values else don’t and possibly make a text box visible that says either gender or favorite food is blank.

Yes I want to create a record with both gender and foodtype set. How would that code look?