Discussions

Expand all | Collapse all

var text - Placement/Efficiency

  • 1.  var text - Placement/Efficiency

    Posted 20 days ago
    Edited by J H 20 days ago
    I have a field titled Comments (Text) and a field titled Hover (Formula – Rich Text). For the purpose of concise formatting:
    • The Comments field is for text entry only, appearing on forms, but is not displayed in report view, for the purpose of concise formatting.
    • The Hover field does appear on reports: it shows a hyperlink that upon mouse-over, will reveal the comments in a popup bubble. I have accomplished this so far with the following in the Hover field:

    "<div style=\"width:10px;\"> "& Left(Right([Comments],"["),0) &"</div>"&

    "<a href='"&Dbid()&"?a=dr&rid="&[Record ID#]&"' title='"&[Comments]&"' target\n=\"_blank\" \"> Comments</div></a>"

    However, due to an html-related limitation as I understand it, the comment shown upon hover is cutoff at the first appearance of an apostrophe (or single quotation). For example:

    Comment says:

    Hover only displays:

    Documents to be sent to buyer's Florida address

    Documents to be sent to buyer

    Documents rec'd from seller 1 but not seller 2

    Documents rec

     

    One suggestion I found to resolve this was to use the SearchAndReplace function to replace the apostrophes with a character that html will allow:

    var text apost = SearchAndReplace([Comments],"'","");
    $apost

    To be quite frank, I had no idea where to enter this…so I created another field, titled "Comment Transponder" (Formula – Rich Text). It does not appear on reports or forms, and serves only as a relay to remove the single apostrophes so that the apostrophe-less text can then be shown in full upon hover.

    Comment says:

    Comment Transponder Field says:

    Hover now shows:

    Documents to be sent to buyer's Florida address

    Documents to be sent to buyers Florida address

    Documents to be sent to buyers Florida address

    Documents rec'd from seller 1 but not seller 2

    Documents recd from seller 1 but not seller 2

    Documents recd from seller 1 but not seller 2

     

    Is there a more efficient way to do this (that would eliminate the need for the Comment Transponder field)? 



    ------------------------------
    J H
    ------------------------------


  • 2.  RE: var text - Placement/Efficiency

    Posted 20 days ago
    For the HOVER field, enter the var before the main formula. Then, anywhere you would normally us the COMMENT field, use the variable

    Example:

    Without var: SearchAndReplace([a],"'"," ") + [b]

    With var:
    var text newa = SearchAndReplace([a],"'"," ");

    $newa + [b]

    ------------------------------
    Blake Harrison - DataBlender.io
    Quick Base Solution Provider
    ------------------------------