Apr 21, 2017 11:30 AM
Hello!
I’m trying to put together node js logic to find record ids for two concatenated fields as the key field.
I’ve gotten through my issues of having commas in my search strings, but now I have compound issues with both commas and single quotes in my strings.
I’m ending up with a filterbyformula variable that looks like this:
{Song ID} = ‘“A Midsummer’s Breeze”-“Meditations for Relaxation, Vol. 1”’
My logic has found both the single quote and the comma, enclosed both of the constituent pieces in double quotes and then enclosed the entire string in single quote.
Airtable doesn’t like this and cannot find the record.
In the DB, the record looks like this:
A Midsummer’s Breeze-“Meditations for Relaxation, Vol. 1”
Before I make myself nuts trying to suss out a solution, I thought I would ask you trustworthy and kind fellow coders…
Thanks in advance for any help!
Cindy
Apr 24, 2017 03:12 AM
You can probably change these extra (double!) quotes in %22 instances instead. I haven’t tried the comma myself, but that should be %2C.
Does that work for you? :slightly_smiling_face:
Have a look at http://www.asciitable.com and use the hexadecimal values in case of problems.
Apr 24, 2017 07:29 PM
Thanks for your response! Thinking through it all.
Cindy
Nov 23, 2018 09:32 AM
Did you ever find a solution to the comma issue? I am experiencing the same thing. My code works for all records except the ones containing commas.
Example: ‘Company Name, LLC’
&filterByFormula={Customer}=‘Company Name, LLC’
The url is being encoded and still fails. Not sure if there is a way to escape the comma, or if this is an Airtable API bug.
Jan 04, 2024 01:20 PM
I had this issue with a single quotation mark and was able to use Tuur's approach by replacing it with %27 and that worked great!
const filter_by_formula = `{Company} = '${name.replaceAll("'", "%27")}'`