Aug 08, 2024 05:20 PM
Hi all,
I am creating a resource library and I want different info to be displayed in one field based on the selection in another field.
Im sure I am over thinking this and there is an easy solution!
Here is the example;
My base is displayed in a gallery view.
Based on the 'Provider' listed, I want the description to change relevant to the 'Name' (e.g. Online Learning platforms'). If more than 1 'Provider' is listed, I want info for both to be displayed.
Is there an easy solution for this? or a workaround?
Many thanks!
Nick
Aug 08, 2024 06:14 PM
There are a few different ways to skin this cat!
To display different information based on the provider selected, you can create a separate table for your providers where each provider has its own description. Then, in your main table, link to this provider table so you can select one or more providers. Once you've done that, you can use a lookup field to pull in the relevant descriptions based on the selected providers. Finally, if you want to combine all the descriptions into one field, you can use a simple formula to do that. This way, in your gallery view, the description field will automatically update to show the correct information for the selected providers.
Here’s how you can set it up:
Step 1: Create a Table for Providers
Create a new table for your providers (if you haven't already). This table should include:
A "Provider" field (Single select or Single line text).
A "Description" field (Long text or Single line text) where you can enter the specific information for each provider.
Step 2: Set Up the Main Table
In your main table (the one where you have the 'Name' field), create a Linked Record field that links to the Providers table. This will allow you to select one or more providers.
Create a Lookup Field in the main table that looks up the "Description" field from the Providers table. This will bring in the relevant description(s) based on the selected provider(s).
Step 3: Combine Descriptions
If you want to combine the descriptions into a single field, you can use a Formula Field. The formula would look something like this:
ARRAYJOIN({Lookup Field}, ", ")
This formula will concatenate the descriptions for all selected providers into a single text string, separated by commas.
Step 4: Display in Gallery View
In the gallery view, you can now display the formula field that contains the concatenated descriptions. This will dynamically update based on the selected provider(s).
Example Setup
Providers Table:
Provider: "Udemy"
Description: "Online courses on various topics."
Provider: "Coursera"
Description: "Online courses from universities."
Main Table:
Name: "Online Learning Resources"
Provider (Linked Record): "Udemy, Coursera"
Description (Lookup Field): "Online courses on various topics., Online courses from universities."
Combined Description (Formula Field): "Online courses on various topics., Online courses from universities."
Aug 08, 2024 08:25 PM
@Breakneckbrandssolution is how I'd go about it as well as it's a lot easier to maintain. If you really want to use a formula you can use a `SWITCH()`: https://support.airtable.com/docs/formula-field-reference
Aug 08, 2024 08:42 PM
Awesome! thank you! one question - the description for each Provider changes depending on the {Name} field.
So if the Provider is CompanyA and the Name field is 'Online learning platform' the description is xxx
but if it is a different Name field changes eg 'Marketing templates', and the company stays the same, the description will be different.
The Name field represents different products.
So if this was my new Providers Table, can the formula lookup the company (e.g. CompanyA), and lookup the Name (e.g. Online learning platform), then pull through the unique description?
I hope that makes sense!
Aug 08, 2024 09:36 PM
Aug 08, 2024 10:15 PM
Nope, it'd all be hardcoded within the SWITCH() formula itself!