Forum Discussion

_anomDiebolt_'s avatar
_anomDiebolt_
Qrew Elite
9 years ago

Two And A Half Tips

I am running through 100s of formulas harvested from different sources and seeing some common patterns where the formula are overly complex and easy to fix:

(1) When forming a query clauses you don't have to include the single quotes popularized by the QuickBase documentation:

Instead of this:
{'3'.EX.'foo'}
Just use this:
{3.EX.foo}
(2) When forming HTML attributes you don't have to use an escaped double quotes:

Instead of this:
"<img src=\"https://www.quickbase.com/up/" & Dbid () & "/a/r" & [Record ID#] & "/e7/v0\" />"
Just use this:
"<img src='https://www.quickbase.com/up/" & Dbid () & "/a/r" & [Record ID#] & "/e7/v0' />"
In fact, HTML does not even require any attribute quotes if there are no spaces (or other offending characters) in the attribute value:
"<img src=https://www.quickbase.com/up/"; & Dbid () & "/a/r" & [Record ID#] & "/e7/v0 />"
(2.5) When using data-attributes on HTML elements you have to use quotes on attributes that might contain spaces (and a few other offending characters):
[iol] & "moduleTable.js" & [/iol]&
"<a class='QBU_Button Vibrant Success' " &
"  data-rid='" & [Record ID#] & "'" &
"  data-name='" & [Name] & "'" &
">Button</a>"
The single quotes are not needed on the data-rid attribute because a [Record ID#] will never contains a space but are needed on the data-name attribute because [Name] will likely contain a space. Additionally, if the field you are trying to pass in a data attribute itself contains quotes you would have to use an character entity (eg &quot;) to pass the value.

1 Reply