View with data from two different tables

I have two tables currently. Table 1 has the main customer information in it and Table 2 is logging all changes that are made to a particular customer record.

When the user clicks on a Customer record in the App View I want to show the full list of changes that have occured for that account (Table 2) in the Customer View along with all the existing customer ino (Table 1). Having trouble figuring out how to do this. It should be using the Customer Record number as the key to pull the info from Table 2

Table 1:

2023-12-18 10_15_52-Sample DB_ Table_1 - AppSheet databases.png

 

Table 2

2023-12-18 10_15_41-Sample DB_ Table 2 - AppSheet databases.png

 

View

2023-12-18 10_16_49-Test App.png

 

Solved Solved
0 7 328
1 ACCEPTED SOLUTION

 

Assuming:

  • Table 1 = Customer
  • Table 2 = Tasks

and:

Aurelien_7-1703009195183.png

I gave it a try, and...AppSheet Database offers difficulties, compared to when using Google Sheets.

Can you try instead, to create a virtual column:

Aurelien_12-1703009646388.png

Aurelien_11-1703009615498.png

FILTER("task",[customer_record]=[_THISROW].[customer_record])

It works for me:

Aurelien_13-1703009716009.png

 

 

 

 

View solution in original post

7 REPLIES 7

Aurelien
Google Developer Expert
Google Developer Expert

Hi @googlenoob62 

In your app editor, on the Table 2 "Changes", please set the type Ref (which stands for "Referencing to") for your column name "Customer number", and set the source table to your table 1 "Customer".

Please note:

In your table 1 Customer, you MUST set your column "customer number" as being the key of your table, otherwise that won't work.

Aurelien_0-1702917444066.png

 

For reference:

Add references between tables - AppSheet Help

References between tables - AppSheet Help

 

I followed the article but it doesnt seem to be working for me:

Table 1 (Formula that is populated: REF_ROWS("Table 2", "Customer Record"))

2023-12-18 13_02_55-Test App - AppSheet.png

 Table 2

2023-12-18 13_02_16-Test App - AppSheet.png

 

The Table 2 should have [Row ID] as the Key, not [Customer Record].

The [Related] column you created will be generated automatically. You don't need to create it manually. I invite you to delete it.

I made that change and it is still not showing the data from Table 2 in the view. Even in the Database view it doesn't show anything in that column and it doesnt allow me to set the reference column as a label.

View

2023-12-19 11_10_37-Test App - AppSheet.png

 

Table 1

Table 1.png

 

Table 2

Table2.png

 DB View of Table 2

DB.png

 DB View of Table 1

db2.png

 

 

Assuming:

  • Table 1 = Customer
  • Table 2 = Tasks

and:

Aurelien_7-1703009195183.png

I gave it a try, and...AppSheet Database offers difficulties, compared to when using Google Sheets.

Can you try instead, to create a virtual column:

Aurelien_12-1703009646388.png

Aurelien_11-1703009615498.png

FILTER("task",[customer_record]=[_THISROW].[customer_record])

It works for me:

Aurelien_13-1703009716009.png

 

 

 

 

What you provided works with the virtual column: FILTER("Table_1",[Customer Record]=[_THISROW].[Customer Record])

It does appear though to only pull one row back in the View and for waht ever reason is showing data on the wrong accounts. Any ideas what I did wrong? (using the same data in the images and only data for the one customer should be showing up)

 

It should show 4 different rows for this account but only shows one:

2023-12-19 13_30_28-Window.png

 It looks to be picking random rows for the other accounts that do not have the same customer number:

2023-12-19 13_33_35-Window.png

 

 

Hi @googlenoob62 

Can you make sure you have this setting enabled?

Aurelien_0-1703059980387.png

 

Top Labels in this Space