Confused about refs

TJD
New Member

I have 2 tables: Prep Log and Samples

Prep log has one entry per experiment, and the key is:
CONCATENATE([Instrument],": โ€œ,[Start Date],โ€: โ€œ,[Experiment ID],โ€: ",[Equipment])

Samples can have multiple entries per experiment, and the key is:
CONCATENATE([Experiment ID],": โ€œ,[Sample ID],โ€: โ€œ,[Sample Holder ID],โ€: โ€œ,[Sample Change],โ€: "[Position])

I would like to open up the Prep Log entry, and see the referenced samples at the bottom. I know this is possible, Iโ€™ve seen examples, I read the Help entry on References, but canโ€™t get it to work for me. Specifically, following the instructions for โ€œUser-Added Referencesโ€ resulted in this error: Column Name โ€˜Related Samplesโ€™ in Schema โ€˜Prep Log_Schemaโ€™ is a virtual column without an app formula." This is sensible, of course it needs a formula, but it doesnโ€™t tell me what formulas can work.

I have it partially working, though, hereโ€™s what Iโ€™ve done:

  1. Create a VC in the Sample table, called it PrepRef, and copied exactly the key for the Prep Log table. It wouldnโ€™t work at all otherwise, I tried using Ref_Row with just the Experiment ID and skipping Step 2, but it didnโ€™t display any output at all.
  2. Create a virtual column in the Prep Log table, and the formula is REF_ROWS(โ€œSamplesโ€, โ€œPrepRefโ€).
    There arenโ€™t any other options on the form at this time, so I save and validate.
    So when I view my Prep Log entry, it will show my list of 2 samples. Itโ€™ll open a form from the prep log entry so I can add a new Samples entry. Nice, but it wonโ€™t show me details of the samples that already exist for that prep log.

I switch the type to Ref, but of course then Ref_Rows throws an error, because Ref canโ€™t be type Ref, fine, it has to be a List. The only things I see that say they result in type Ref are Minrow and Maxrow, which donโ€™t seem useful here.

Any idea what Iโ€™m missing?

0 3 626
3 REPLIES 3

TJD
New Member

To be clear, the example app that I was looking at was Order Capture. It works obviously with Ref_Rows and type List. But it is clearly operating with single column keys. When it evaluates the expression REF_ROWS(โ€œOrdersโ€, โ€œCustomer Nameโ€), the result is:

The list of values of column โ€˜Order Idโ€™
โ€ฆfrom rows of table โ€˜Ordersโ€™
โ€ฆwhere this condition is true: ((The value of column โ€˜Customer Nameโ€™) is equal to (The value of column โ€˜Nameโ€™))

For my app, ignoring step 1 in my other attempt, the expression is Ref_Rows(โ€œSamplesโ€,โ€œExperiment IDโ€) and the result is:
The list of values of column โ€˜_ComputedKeyโ€™
โ€ฆfrom rows of table โ€˜Samplesโ€™
โ€ฆwhere this condition is true: ((The value of column โ€˜Experiment IDโ€™) is equal to (The value of column โ€˜_ComputedKeyโ€™))

And the actual result is nothing at all in my app, because my samples need a more unique key than the experiment ID by itself.

If the answer to my question is that Refs donโ€™t work with multi-column keys, then Iโ€™m not sure what the point of any of it is.

@TJD, did you find a solution to this as I have a similar issue?

The easiest way to automatically create a Ref is to have the first column of the second table equal the name of the first table. So in your case Column A in Samples should be called [Prep Log]. Then Appsheet will automatically link them.

If needs be, remove the Prep log table, add this column then re-add the table. Once youโ€™ve got this working, then you can try to create your own Refs

Also for your key column, I suggest using an Initial_Value of UniqueID() as this generates a 6char AlphaNum key

Simon@1minManager.com

Top Labels in this Space