Variable field in formula query

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

I am trying to insert a field from my current/referring table into a query on another table. I am able to replace the field [Name] with static data and return the results I need, however, trying to replace the static data with the data in the referring table's field always yields 0 results.

Is my syntax incorrect or is what I'm doing not possible to do?


URLRoot() & "db/" & quiery_dbid() & "?a=API_GenResultsTable&query={'19'.CT.'[Name]'}&clist=6.7.8.12.29" & "&ifv=20"

(query_dbid = ID of other table)

Photo of Robert

Robert

  • 0 Points

Posted 3 years ago

  • 0
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,064 Points 20k badge 2x thumb
You are attempting to interpolate the [Name] field in the middle of a double quoted string:

"?a=API_GenResultsTable&query={'19'.CT.'[Name]'}&clist=6.7.8.12.29"


Instead you need to concatenate the [Name].with two strings - one to the right and one to the left.

Writing the formula in this fashion (one query parameter assignment per line) may help avoid common mistakes like this:

URLRoot() & "db/" & query_dbid &
"?a=API_GenResultsTable" &
"&query={19.CT." & [Name] & "}" &
"&clist=6.7.8.12.29" &
"&ifv=20"
Photo of Robert

Robert

  • 0 Points
I think I understand - almost as if the QB variable needs to be called on its own without inserting it into another string. Thanks Dan!