Mar 29, 2022 08:53 AM
Hello all,
I am trying to design a base for employee contracts, with some employees having salaries paid in multiple currencies.
The way I intended to design this was to have a contract table, where the contract date and employee name would be written in fields, and have a ‘contract details’ table with multiple lines per contract, one per currency.
The way I intended to consolidate the total compensation was to convert everything in USD in the “contract details” table, and then to sum it back in the Contract table. But for this I need some way to fetch the exchange rate.
This is where I get stuck. How can I achieve this?
What I would have done in Excel for instance, would be to have another table with yearly rows/records, and 1 field/column per currency, and then index/match/lookup the exchange rate for the given year and currency as a new field in the ‘contract details’ table. I could then multiply this exchange rate with the salary to get the amount in USD.
In other words, how do I populate this field with data from another table, knowing that it needs to correspond to both the currency and date?
Mar 29, 2022 09:20 AM
You have a pretty good understanding of what you need to do. You will need a script to ‘fetch’ the data from an API.
Here is a great video on how to create a script that does that: Learn Airtable scripting #4: Using APIs in Airtable scripts with Giovanni Briggs - YouTube. You will just need to adjust for an exchange rate api instead of a weather api.
Mar 29, 2022 06:25 PM
Have you tried using the Currency Converter App?
Mar 30, 2022 05:16 AM
I’ll take a look, thanks!
Mar 30, 2022 05:17 AM
This could be a solution, but I would rather have some solution that fetches the relevant exchange rate from a table within the base, so that I can enter one reference rate for 2021, for example, and then use this everywhere in the base where needed.