Discussions

Expand all | Collapse all

Syntax error in a Rich Text Formula

  • 1.  Syntax error in a Rich Text Formula

    Posted 24 days ago
    Can someone spot my syntax error in this formula? When I try to save it says rdr needs to preceded with a (, but that does not work. 

    If([Sent Checkbox],"<a href='" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "&apptoken=dwh245kc9bvrzfcqkqfwmd876gjx&_fid_35=0& ("&rdr="&URLEncode(URLRoot() & "db/" & Dbid() & "?a=doredirect&z"= & Rurl())& "'><img src=\"https://images.quickbase.com/si/16/018-email_unread.png\"></a>","<a href='" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "&apptoken=dwh245kc9bvrzfcqkqfwmd876gjx&_fid_35=1& "&rdr="&URLEncode(URLRoot() & )"db/" & Dbid() & "?a=doredirect&z"= & Rurl()& "'><img src=\"https://images.quickbase.com/si/16/016-email_1.png\"></a>")

    ------------------------------
    George Bramhall
    ------------------------------


  • 2.  RE: Syntax error in a Rich Text Formula

    Posted 24 days ago
    try this ... but what I recommend is to use formula variables for each part of the IF result and then put them together in the IF

    I also recommend putting this into a formula variable


    like var text Refresh = URLEncode(URLRoot() & "db/" & Dbid() & "?a=doredirect&z"= & Rurl();

    If([Sent Checkbox],
    "<a href='" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#]
    & "&apptoken=dwh245kc9bvrzfcqkqfwmd876gjx&_fid_35=0"

    &

    "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=doredirect&z"= & Rurl()

    & "'><img src=\"https://images.quickbase.com/si/16/018-email_unread.png\"></a>","


    <a href='" & Dbid() & "
    ?a=API_EditRecord&rid=" & [Record ID#]
    & "&apptoken=dwh245kc9bvrzfcqkqfwmd876gjx&_fid_35=1"
    & "&rdr="&URLEncode(URLRoot() & )"db/" & Dbid() & "?a=doredirect&z"= & Rurl()& "'><img src=\"https://images.quickbase.com/si/16/016-email_1.png\"></a>")


    if that does not work and you want to post back please copy and paste your error message.

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 3.  RE: Syntax error in a Rich Text Formula

    Posted 22 days ago
    Hi Mark,
    Thanks for the reply!
    It comes back saying expecting text (highlighting the & before the Rurl() in the var)
    var text refresh = URLEncode(URLRoot() & "db/" & Dbid() & "?a=doredirect&z"= & Rurl();

    If([Sent Checkbox],
    "<a href='" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#]
    & "&apptoken=dwh245kc9bvrzfcqkqfwmd876gjx&_fid_35=0"
    & $refresh
    & "'><img src=\"https://images.quickbase.com/si/16/018-email_unread.png\"></a>","
    <a href='" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#]
    & "&apptoken=dwh245kc9bvrzfcqkqfwmd876gjx&_fid_35=1"
    & $refresh & "'><img src=\"https://images.quickbase.com/si/16/016-email_1.png\"></a>")

    ------------------------------
    George Bramhall
    ------------------------------



  • 4.  RE: Syntax error in a Rich Text Formula

    Posted 22 days ago
    That button is actually quite complex.  You are trying to present two different hyperlinks, each doing a different URL plus a Page Refresh and two different images.  Unless you are a better coder than I am you have no hope of writing it in the syntax you wrote it in. 

    You really must break it down into pieces.  Yes it will be a lot longer formula, but its really just a lot of Copy and Paste.

    This tested OK and is easy to read and hence to debug.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    var text RefreshPage = URLRoot() & "db/" & Dbid() & "?a=doredirect&z=" & Rurl();

    var text UnToggleURL = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#]
    & "&apptoken=dwh245kc9bvrzfcqkqfwmd876gjx"
    & "&_fid_35=0";

    var text ToggleURL = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#]
    & "&apptoken=dwh245kc9bvrzfcqkqfwmd876gjx"
    & "&_fid_35=1";

    var text UnToggleRefresh =
    $UnToggleURL
    & "&rdr=" & URLEncode($RefreshPage);

    var text ToggleRefresh =
    $ToggleURL
    & "&rdr=" & URLEncode($RefreshPage);


    var text UnreadImage = "<img src=https://images.quickbase.com/si/16/018-email_unread.png>";

    var text ReadImage = "<img src=https://images.quickbase.com/si/24/016-email_0.png>";

    var text UnReadHyperlink =
    "<a href=" & $UnToggleRefresh & ">" & $UnreadImage & "</a>";

    var text ReadHyperlink =
    "<a href=" & $ToggleRefresh & ">" & $ReadImage & "</a>";


    If([Sent Checkbox], $UnReadHyperlink, $ReadHyperlink)

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 5.  RE: Syntax error in a Rich Text Formula

    Posted 22 days ago
    Edited by George Bramhall 22 days ago
    Mark,
    You are amazing. I do not think like a programmer so to program like you is a hopeless cause. Your formula is now easy to follow and makes sense to me now that I see it and know that it works. Thank you very much. I will reference this syntax formula for future button attempts.

    ------------------------------
    George Bramhall
    ------------------------------