Need some help please. Have two tables. Tabl...

Need some help please.

Have two tables. Table 1: Gen Pop Evacuation Center Registration Table 2: Gen Pop Pet Registration

Table 2 contains an ID column that is Ref type back to Table 1.

I want to add a virtual column to Table 1 that will show the pet location from Table 2. But when I try the expression below it shows every pet location not just the location for that ID:

Gen Pop Pet Registration[Pet/Crate Location]

How do I filter it by registration ID?

Iโ€™m good with references from table 1 to table 2 [ID].[col] - but not the opposite direction.

0 15 387
15 REPLIES 15

Almost worksโ€ฆthe expression verifies but seems itโ€™s still giving me everything:

SELECT(Gen Pop Pet Registration [Pet or Crate Location],[ID]=[ID])

Thank you both.

Is there a way to get all the pet locations related to the owner (parent) record or just the top one?

I guess the pet teams plan is separate locations for cats and dogs so Iโ€™m struggling with the best way to display the info they want in a table view.

@Aleksi_Alkio you are very right.

@Aleksi_Alkio the any select works.

now my question is can I add another condition to this statement?

Since they are separating dogs and cats and I can only get one room number to appear Iโ€™m thinking of adding a 2nd virtual column so I can have Dog Location, Cat Location, but not sure how to write it.

This didnโ€™t work:

SELECT([Related Gen Pop Pet Registrations][ Pet or Crate Location], [PetTypeDog]=true, [ID]=[_THISROW].[ID])

Hi @Tammi_Canelli maybe try an AND in there. โ€ฆAND([PetTypeDog]โ€ฆ)

Here is the column data.

Do I need to incorporate the PetID somehow since itโ€™s the key in the pet table?

Might need ANY(SELECTโ€ฆ

@Tammi_Canelli

Yes, please include [PetID] in your expression. I had mentioned it so to include names of columns in respective tables.

Hi @Stephen_Mattison , Any may not be required as there could be multiple related records and as such the resulting column needs to be list type.

Just to reiterate,

the expression needs to have [name of Key column of table 1] =[name of ref column of table 2]

Also names need to be a bit different, because otherwise,

the system may not understand,

these are columns of two different tables. Hence requested a bit different name for ref column of table 2.

Hope this helps.

When you already have a list of child records in your parent table (table 1), You could read the correct value likeโ€ฆ ANY(SELECT([VirtualRefListField][SourceColumn],[ID]=[_THISROW].[ID])). If there are more than one record with the same ID, then it will show the first one. You need to use your own column names but the format should be fine.

@Aleksi_Alkio, Yours is compact and to the point solution as usual

For some reason users donโ€™t know the structure SELECT([VirtualList][SourceColumn],TRUE) when the REFROWS is used. It helps because you donโ€™t need to read the whole table again. You have that list already but itโ€™s much smallerโ€ฆ normally just few records.

Hi , Based on my understanding, you wish to refer back [Pet Location] from Gen Pop Pet Registration table into Gen Pop Evacuation Center Registration. You have a reference type column in Table 2 that refers Key column of Table 1.

If this is so, please try with the following expression by creating a virtual column of type list in Table 1

SELECT(Gen Pop Pet Registration [Pet/Crate Location],[Key Name of Table 1]=[Reference Column Name in Table 2 that refers to Table 1])

You may wish to remove / in column name [Pet/Crate Location], as such characters are typically reserved in computer expressions and may lead to errors.

Hope this helps.

Sorry, please ignore [PetID]. Please rename ref column

[ID] as say [IDPR] and please try the following

SELECT(Gen Pop Pet Registration [Pet or Crate Location],[ID]=[IDPR]) Presume [ID] is key nameof table 1. Or please use that key name here.

Top Labels in this Space