What happens when you select two (2) or more columns as keys in a table ?

I understand that when select two (2) columns -or more- as key in a table app sheet creates a virtual column that combines the columns selected as keys.   

However, what I need help understanding is how AppSheet treats/handles this new "combined" key when I REF this table from another table (that only have one of the key columns in it)?

1) Do I need to have a matching "combined" key?

2) Do I only need to have one of the values in the combined key to match? 

 

 

0 5 1,549
5 REPLIES 5

You cannot have "two or more" columns as key. You can only have one single key column. When you mark more than one column as key, you merely instruct AppSheet to construct a new key column combining the values of the marked columns. Once the new key column is constructed, none of your marked columns will be key any more. 

Therefore, yes, the values of your ref columns will be matched against the values of the combined key. 

1)

Also, this is a common scenario on a DBMS and it's known as composite key, to make sure that a certain combination of values is unique. Here is a good video explaining it if you want to take a look

Joseph/SkrOYC:

 

Thank you for your prompt reply to my newbee question. 

Now it is clear that when two columns are selected as keys they form a completely new key using the values of the two columns selected. 

Question: 

is there a snipet code to compare (or ref) a table to just one part of the combined key? 

 

Description: 

Table 1) Have an old jobs table that exists with about 10 years worth of jobs information (That do not have an ID column in it)  (Ref = Job_No - because they do not repeat)

Table 2) Have a time table that has test times and measurements recorded using the job number as reference  (Many measurements per job for different dates and times).  (Also has about 5 to 6 years worth  of jobs data.)

Table 3) Have a new jobs table that I am trying to use to bring in only the information for the jobs we are currently working on.  (Trying to Reduce amount of data to work with in the app - so it is easier to track as I work on the formulas)

  1. This table has a unique ID column assigned to each record.  
  2. This table will be used to calculate some rest results for comparison with other tests done at a later time. 
  3. Need to bring in the information from table 1 and table 2. 

I am trying to link the information from Table 1 and Table 3 to Table 2.  But do not know how to ref the values to copy the data from tables 1 and table 2 into Table 3. 

 

Hope this makes sense... 

Hi @FTong, always a pleasure to help you. I know you have been doing hard work to understand everything the last months between your busy job.

This is actually a new scenario and I encourage you to make a separate post talking about it.

Anyway. My advice:

Eventhough there is a lot of data, you could filter it using a security filter in order to make sure that just the the jobs that are open are sync with the AppSheet server.

Same thing applies to the 2nd table, you don't need to have all of the items from this 2nd table, you could make a security filter with basically the same expression for the 1st one using a reference (kinda).

In general, don't create a 3rd one, it doesn't makes sense to be fair.

SkrOyC, 

Thank you for your response and advice.   I will post the follow-up question as a second post on the chat.  Hopefully, someone else may also benefit from your and the other member's answers... 

And, yes.  you are right, I have been putting in some long hours getting the hang of Appsheet when I have the chance. 

Every time I pick Appsheet up again I come across another data collection/processing process that could be SIMPLIFIED  by using Appsheet.    Right now I have about 5 or 7 processes that I am trying to get to work with Appsheet.  Unfortunately, I hit roadblocks on each one of them and have not been able to get them to the field for testing yet.  

Top Labels in this Space