Forum Discussion

MannyCruz's avatar
MannyCruz
Qrew Assistant Captain
8 years ago

Formula Syntax Help

I am trying to get this formula to work so that it changes the status field of a record to display a different section of a form (for reference purpose). So when the button is clicked, the status will change to whatever part of the form the person wants to see. But it has to be in view mode, not edit mode. I cant figure out where my syntax error is. 

var text url = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&rid="&[Record ID#]&"&_fid_340="&"Initial Screening";

"<a class='Vibrant Success' href='" db/" & Dbid() & "?a=dr&rid=" & [Record ID#]) &"'>Initial Screening</a>"

I keep getting "Extra characters after end of formula
  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    So there are a few things missing and a few quotes misplaced.

    So it looks like you are hoping to edit the record, then rdr to display the record.  I'd recommend this:


    var text URLOne=URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&rid="&[Record ID#]&"&_fid_340="&URLEncode("Initial Screening");
    var text URLTwo=URLRoot() & "db/" & Dbid() & "?a=dr&rid="&[Record ID#];
    "<a class='Vibrant Success' href='"&$URLOne&"&rdr=" & URLEncode($URLTwo)&"'>Initial Screening</a>"

    That should do it for you, and make it easy to copy or modify when needed.
    • MannyCruz's avatar
      MannyCruz
      Qrew Assistant Captain
      This is perfect! You the man Matt, always helping out, much appreciated!
    • MannyCruz's avatar
      MannyCruz
      Qrew Assistant Captain
      Actually, while you are here Matt,

      another quick question 

      If(     [InitalScreenCHKBX] = true
      and
           [FormOfEnt.CHKBX] = false,"<a class='Vibrant Success' href='" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "&apptoken=buawcnbd5pjszvdimycfs3jdpzd&_fid_340=Initial Screening"  & "&rdr=" & URLRoot() & "db/" & Dbid() & "?a=showpage&pageid=87" & "\" ) & '>Return To Dashboard</a>",
      If(
           [FormOfEnt.CHKBX] = true
      and
           [DueDiligenceCHKBX] = false,"<a class='Vibrant Success' href='" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "&apptoken=buawcnbd5pjszvdimycfs3jdpzd&_fid_340=Appointment Paperwork"  & "&rdr=" & URLRoot() & "db/" & Dbid() & "?a=showpage&pageid=87" & "\" )& '>Return To Dashboard</a>",
      If(
           [DueDiligenceCHKBX] = true
      and
           [ChecklistCHKBX] = false,"<a class='Vibrant Success' href='" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "&apptoken=buawcnbd5pjszvdimycfs3jdpzd&_fid_340=Due Diligence"  & "&rdr=" & URLRoot() & "db/" & Dbid() & "?a=showpage&pageid=87" & "\" )& '>Return To Dashboard</a>",
      If(
           [ChecklistCHKBX] = true
      and
           [Appointed?] = false,"<a class='Vibrant Success' href='" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "&apptoken=buawcnbd5pjszvdimycfs3jdpzd&_fid_340=Due Diligence"  & "&rdr=" & URLRoot() & "db/" & Dbid() & "?a=showpage&pageid=87" & "\" )& '>Return To Dashboard</a>"))))

      it looks like alot, but its the same thing repeated a few times. Basically. This button returns the user to a specific dashboard. But before doing so, it changes the status field, depending on what checkbox is checked. 

      This is more of a side issue and can be placed on the back burner. But if you have some time. 

      It gives me no QuickBase errors, the button just wont show up.
    • MannyCruz's avatar
      MannyCruz
      Qrew Assistant Captain
      Nevermind guys, I actually figured out what my mistake was, I was referencing the wrong fields haha. Oops. 
  • MannyCruz's avatar
    MannyCruz
    Qrew Assistant Captain
    Okay so I lied, it still isn't working. It's supposed to be a conditional button but I can't figure out where the syntax error is. It won't tell me, it says it could me mismatched parenthesis or brackets, but I counted and double counted. Help?

    If(     [IScomp] = true
    and
         [APcomp] = false,"<a class='Vibrant Primary' href='" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "&apptoken=buawcnbd5pjszvdimycfs3jdpzd&_fid_340=Initial Screening"  & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=showpage&pageid=87\") & '>Return To Dashboard</a>",
    If(
         [APcomp] = true
    and
         [DDcomp] = false,"<a class='Vibrant Primary' href='" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "&apptoken=buawcnbd5pjszvdimycfs3jdpzd&_fid_340=Appointment Paperwork"  & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=showpage&pageid=87\") & '>Return To Dashboard</a>",
    If(
         [DDcomp] = true
    and
         [CLcomp] = false,"<a class='Vibrant Primary' href='" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "&apptoken=buawcnbd5pjszvdimycfs3jdpzd&_fid_340=Due Diligence"  & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=showpage&pageid=87\") & '>Return To Dashboard</a>",
    If(
         [CLcomp] = true
    and
         [Appointed?] = false,"<a class='Vibrant Primary' href='" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "&apptoken=buawcnbd5pjszvdimycfs3jdpzd&_fid_340=Due Diligence"  & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=showpage&pageid=87\") & '>Return To Dashboard</a>"))))
    • MCFNeil's avatar
      MCFNeil
      Qrew Captain
      Try this:

      Yours currently:
      eturn To Dashboard</a>"))))

      My Small change:
      eturn To Dashboard</a>", "" ))))

      I'm adding an else statement and the comma
    • MannyCruz's avatar
      MannyCruz
      Qrew Assistant Captain
      Still no dice, good observation though! I'll have to dig into this one and maybe just restructure the formula if anything. Thanks Matt
  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    Found it.
    When you have the rdr and showing the pagid you can't comment out the last quote.

    Yours:
    &pageid=87\") & '>Ret


    What it needs to be:
    &pageid=87") &"'>Ret

    I removed the slash ( \ ) after the 87 and added a quote ( " ) before the single quote.
    Keeping the same syntax from the above suggestion you should be good to go.
    • MannyCruz's avatar
      MannyCruz
      Qrew Assistant Captain
      Thanks Matt! I appreciate the follow through, it works!