How to reference data if the primary keys don't match

Hello,

I am building an app and having an issues in referencing data from two tables because the PK are different.

In the table “Trade”. I have column that indicates that it has been rolled.
I would like to display all the rolled trades in “Roll” table in the Trade View.

With SQL query function this would have been very easy fix but in appsheets (using Google Sheets) I don’t seem to be able to figure out.

Thank you community in advance!

Solved Solved
0 7 96
1 ACCEPTED SOLUTION

In the ROLL table, set the Trade ID column type to Ref, and select TRADE as the referenced table. AppSheet will then automatically add a Related ROLL column to each record of your TRADE table. Thus when you open a TRADE record you will see whether there are related Rolls and what are they.

In the TRADE table, if you want to keep the Roll column, you can set its type to (Yes/No) column, and its App formula as:

COUNT([Related ROLL]) > 0

View solution in original post

7 REPLIES 7

In the ROLL table, set the Trade ID column type to Ref, and select TRADE as the referenced table. AppSheet will then automatically add a Related ROLL column to each record of your TRADE table. Thus when you open a TRADE record you will see whether there are related Rolls and what are they.

In the TRADE table, if you want to keep the Roll column, you can set its type to (Yes/No) column, and its App formula as:

COUNT([Related ROLL]) > 0

Great point. It did work and a good way for doing it. But the problem is that it shows a inline view even when no Rolls are not present. It gives me an options to add. I don’t want that. Is there a way to conditionally hide it?

You can put the same formula in the Show_if field of the Related Rolls column, so that it displays only when there are Rolls. In the UX you can go to the corresponding view and remove the Inline view column from display altogether.

In Behaviour, go to the action and choose not to display it.

@AVR

Better use this one: ISNOTBLANK([_THIS])

Steve
Platinum 4
Platinum 4

I don’t understand.

I want to see all the rolls from “Roll” table in the “Trade” details view

Thank you everyone you have been very helpful!

Top Labels in this Space