Variable in filterByFormula



Does anyone know if there is a way to filter with a variable in the filterByFormula function through the API? Getting this to work would allow me to fetch information from a specific e-mail, and display records from airtable dependent on that.

So, do this:

var filterstring = ‘shipment_name’;
filterByFormula: Name=filterstring,
}).eachPage(function page(records, fetchNextPage) {

Instead of this:

filterByFormula: ‘Name=“shipment_name”’,
}).eachPage(function page(records, fetchNextPage) {

I’m able to use a string-variable for the find method, but as far as I can tell that only allows me to find on the clunky recordname.

var recordname = ‘recDegFvWIgCSAlzg’;
base(‘Shipments’).find(recordname, function(err, record) {

Apologies in advance if this is a basic question, it’s my first attempt at developing anything with html/js/jquery.



figured out that I could use variables in filterByFormula if I set the entire filter as a variable. So instead of the first suggestion do this:

var filter = “({Name} = '” + shipment_name + “’)”;
filterByFormula: filter
}).eachPage(function page(records, fetchNextPage) {