i noticed that most sample apps are using per...

(tvandang) #1

i noticed that most sample apps are using person’s or item’s name as the primary key. how can that to be used as a UNIQUE key? is this a good practice?

I want to create 2 Tables.

Table Customer CustomerID (primary key) Name Date

Table Item ItemID(primary key) ItemName ItemPrice Quantity Date

How do I connect these 2 tables together in a relationship?

Do i need to create another column in Table Item called fkCustomerID(foreign key) and connect this column as a REF to Table Customer?

Table Item ItemID(primary key) ItemName ItemPrice Quantity Date fkCustomerID

I also want to add up the total ItemPrice for that a Customer and sum it up the total that this customer has bought in between a specified Date.

(Grant Stead) #2

No, it’s not a good practice. Always have a column strictly for a system generated key. I think they did that to make it seem simple… (And most spreadsheet users don’t have irrelevant gibberish in their sheets lol)

(tvandang) #3

@Grant_Stead Thank you.

How do I read a table that will populate the customer name and has its primary key with it(no display from the dropdown list) so that when the user select the customer name, I will take its primary key to read another table to get a certain data from that customer?

(Grant Stead) #4

@tvandang so. Basically appsheet will display the label, but insert the key, so long as everything is referenced correctly. So, make sure your customer table has the key marked key, and the customer name marked as the label.

(tvandang) #5

To populate the employee name drop down list, I use this Employee[EmpName].

This will only contain the employee name and the associated employee key will not be included if I select an employee name from the list ([_THISROW][EMPNAME]. If I created a drop down list using Employee[EmpID], it would work but I don’t know who the employee is based on the EmpID.

work work

(Grant Stead) #6

You need to make that column type REF and remove your valid if lists… And REF that employee table. Then it’ll work…

(tvandang) #7

So if I do that, it will create a drop down list of employee names? How do I get to choose what column can be displayed in the drop down list?

(Grant Stead) #8

It displays whatever label you have chosen for that referenced table… help.appsheet.com - Row Labels Row Labels help.appsheet.com