Skip to main content
Solved

Prefill when duplicate records present


Forum|alt.badge.img+7

In the following top portion of my pre-fill code, everything works fine except when there are duplicate records in the Asset Name field.

All the other pre-filled items work fine. But when there are duplicate Asset Name values, the form displays nothing in the Asset to Update form item.

This duplication is expected and I was thinking I should somehow refer to the Record ID as well so the code will grab to correct record:

CONCATENATE(
IF(
"Prefilling [Update Asset] view in [Assets Updates] table in base with id 'appZyoL5fNNYcN6dv'",
"https://airtable.com/shr7hLXk437tBSfOb"
),
CONCATENATE(
"?prefill_" & ENCODE_URL_COMPONENT("Asset to Update"),
"=" & ENCODE_URL_COMPONENT({Asset Name } & "")
),
CONCATENATE(
"&prefill_" & ENCODE_URL_COMPONENT("Original Module"),
"=" & ENCODE_URL_COMPONENT({Module COPY} & "")
),

What code should I use to clarify the Asset Name to pre-fill when there are duplicate Asset Names?

Thanks for any ideas.

 

Charlie

Best answer by kuovonne

In your Assets table, have a formula field that shows the RECORD_ID(). Then in the linked table, use a rollup field that rolls up the formula field with the record ID. Use the formula ARRAYJOIN(values, ","). Finally, prefill with the rollup field. 

View original
This topic has been closed for replies.

2 replies

kuovonne
Forum|alt.badge.img+29
  • Brainy
  • Answer
  • April 22, 2023

In your Assets table, have a formula field that shows the RECORD_ID(). Then in the linked table, use a rollup field that rolls up the formula field with the record ID. Use the formula ARRAYJOIN(values, ","). Finally, prefill with the rollup field. 


Forum|alt.badge.img+7

In your Assets table, have a formula field that shows the RECORD_ID(). Then in the linked table, use a rollup field that rolls up the formula field with the record ID. Use the formula ARRAYJOIN(values, ","). Finally, prefill with the rollup field. 


Thanks, kuovonne, that worked perfectly, although I don't understand why it worked. Here's the updated code portion:

    CONCATENATE(
        "?prefill_" & ENCODE_URL_COMPONENT("Asset to Update"),
        "=" & ENCODE_URL_COMPONENT({Asset Rec ID} & "")
How does the code know that I want it to put the value found in the Asset Name field into the form, when I'm referencing the Record ID in a Rollup field?
 
I'll read up more about Rollup fields and the difference between ARRAYJOIN and ARRAYUNIQUE.
 
Thanks for your help!