API_AddRecord "Formula Syntax Error"

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
This seems so simple, but I just can't figure this out. I've taken code that I found posted on this site to add a child record by clicking a button on the parent record, but I keep getting the following error...

Formula syntax error

Expected a valid expression after the "&"

Need someone to please explain what I'm doing wrong...

var text AddRecord =
URLRoot() & “db/” & [_DBID_CHILD_xxxx]
& “?act=API_AddRecord &_fid_8=” & URLEncode ([Record ID#])
& “&_fid_6=” & URLEncode([Serial Number])
& “&_fid_7=” & URLEncode([Model-Part No]);

var text DisplayRecord =
URLRoot() & "db/" & dbid()
& "?a=dr&rid=" & [Record ID#];

$AddRecord
& "&rdr=" & URLEncode($DisplayRecord)
Photo of AcornNut

AcornNut

  • 30 Points

Posted 2 years ago

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

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 27,694 Points 20k badge 2x thumb
My formula parser found the error in a jiffy.

You have "smart quotes" introduced by Microsoft instead of double quotes.

Also, there is an extra space after API_AddRecord
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,786 Points 50k badge 2x thumb
Dan,
Pretty soon you can just have your robot respond to all Forum formula syntax question as still be top of the leader board.
Mark
Photo of AcornNut

AcornNut

  • 30 Points
Awesome! That was it. I would've never have figured it out. Thanks!