Oct 22, 2021 10:55 AM
Hello - I’m quite new to Airtable and trying to prototype out an invoicing application, but I’m running into an snag and could use some guidance.
My base:
In SQL I would join on the client ID for both tables, but it’s not yet clear to me whether this kind of join can be done in Airtable. I’ve looked at other invoicing examples and it looks like many have the ITEMS associated at the invoice, but in my use case that may be too laborious with the number of line items and error prone, so automating it off the last updated date would be ideal.
Thanks for the help. Excited for what’s possible with AirTable
Oct 22, 2021 12:06 PM
For anything you would have used join in SQL you use a linked record field in airtable.
Oct 22, 2021 01:41 PM
Consider the following setup, which involves linking Items to Invoices and relies on Automations to do the linking for you:
Have your Items table look like this:
I used a regular date field for {Last Modified}
for testing purposes, but you’d likely use a Last Modified Time-type field. {Last Invoice Month}
converts the {Last Modified}
date and Client name into a unique string that matches the structure of the primary field for the Invoices table. The {Composed Invoices String}
field takes whatever currently linked invoices there are and adds the {Last Invoice Month}
value to the list if its not already there; the formula I used for that is:
IF(
Invoices,
IF(NOT(FIND({Last Invoice Month}, Invoices)), {Last Invoice Month} & ",") & Invoices,
{Last Invoice Month}
)
I set up the Invoices table like so:
Then I set up an Automation to trigger when an Item record’s {Last Modified Month}
field changed. The Automation includes a simple Update Record step that copies the value of {Composed Invoices String}
into the {Invoices}
link field.
The end result is that every time you update an Item, if it hasn’t already been associated with an Invoice record for that month it gets linked to an Invoice record for this month. So long as the Invoices’ table’s primary field isn’t a formula, a new Invoice record will be created if it doesn’t already exist.
Oct 22, 2021 02:06 PM
Thanks so much @Kamille_Parks! It may take me a little time to churn on this and get my head around it, but going to start working through.
Enjoying learning and appreciate the guidance and help!