Discussions

 View Only
  • 1.  How to shorten the display of a text field?

    Posted 05-28-2021 11:39

    I have a comments field that is long enough to really mess up the table view, so I want it to only display the first 20 words unless you click into it. How can I do that?

    I tried to do use this formula to shorten the view of my "appt. comments" text field in my table. 

    Left([Appt. Comments],20)

    However, I received this message "Formula error
    A formula may not contain a reference to itself directly or indirectly through another formula."

    Any idea on how to do this?



    ------------------------------
    Meagan McOlin
    ------------------------------


  • 2.  RE: How to shorten the display of a text field?

    Posted 05-28-2021 12:20
    You would need to have a separate abbreviated field to use on reports.  if you want to get fancier there is syntax to have a 'more' link appear to allow drilling into the record to see the full record.  There is also syntax possible to allow hover text to see the full note

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



  • 3.  RE: How to shorten the display of a text field?

    Posted 05-28-2021 12:33
      |   view attached
    Hi Mark,

    What I need is to shorten the comment display on the table view. So that it doesn't make the record/row it is on so long. I want the record height to be uniform and the comments section is preventing that right now.

    ------------------------------
    Meagan McOlin
    ------------------------------



  • 4.  RE: How to shorten the display of a text field?

    Posted 05-28-2021 12:50
    Mark, what is the hover syntax? Or is that something complicated enough we need to take it offline and consult?

    ------------------------------
    Mike Tamoush
    ------------------------------



  • 5.  RE: How to shorten the display of a text field?

    Posted 05-28-2021 13:03
    Hover syntax is deeper knowledge than I have. :) But I would love to learn.

    ------------------------------
    Meagan McOlin
    ------------------------------



  • 6.  RE: How to shorten the display of a text field?

    Posted 05-28-2021 13:19
    Try this.  The left 20 character should be a Clickable Hyperlink to view the record with "hover text" to see the whole text field.



    var text Words = Left([Appt. Comments],20);
    var text URL = URLRoot() & "db/" & dbid() & "?a=dr&rid=" & [Record ID#];
    var text Hyperlink = "<a href=" & $URL & ">" & $Words & "</a>";

    // then define the hover text
    // Note!!, the hover text must be enclosed in a single ' character as the first space will stop the text.
    // no html allowed in the hover text
    // Use \n for line feed

    var text HoverWords =
    "'"
    & [Appt. Comments]
    & "'";

    // this below will always be the same
    "<div>" & "<span title=" & $HoverWords & ">" & $Hyperlink & "</b></span>" & "<div>"

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



  • 7.  RE: How to shorten the display of a text field?

    Posted 04-25-2022 04:07
    Hi there,

    I used to use a function like below to do this. This has a show more/less function.
    This code is no longer accepted as is seems to be forbidden Javascript.
    I also do you like your hover function. it's functional and simple, I was just wondering if there is no way to shorten text and remain the layout (I mean carriage returns) to keep it better readable?

    Thanks


    >>>>>>>>>>>>>previous code example>>>>>>>>>>>

    If([ACT_Memo]="", "", //If [Notes] is blank, display nothing
    If(Length([ACT_Memo])>300, //If [Notes] is greater than 300 characters
    var Text a = "<span id=&quot;Detail&quot;'><pre style='font-family:&quot;Helvetica&quot;,&quot;Tahoma&quot;,&quot;Arial&quot;,&quot;sans-serif&quot;!important;font-size:100%!important;white-space:pre-wrap!important;'>"&Left([ACT_Memo],300)&"</pre></span>";
    var Text b = "<span id=&quot;Detail&quot;'><pre style='font-family:&quot;Helvetica&quot;,&quot;Tahoma&quot;,&quot;Arial&quot;,&quot;sans-serif&quot;!important;font-size:100%!important;white-space:pre-wrap!important;'>"&NotLeft([ACT_Memo],300)&"</pre></span>";

    //"var Text a" shows the first 300 characters from [Notes]
    //"var Text b" shows the remaining text

    //The following script is the "more/less" function
    $a &
    " <a onclick=\"$(this).hide();$(this).next().show().next().show();\">Show more</a>" &
    " <span style='display:none'>" & $b & "</span>" &
    " <a style='display:none' onclick=\"$(this).hide();$(this).prev().hide().prev().show();\">Show less</a>",
    "<span id=&quot;Detail&quot;'><pre style='font-family:&quot;Helvetica&quot;,&quot;Tahoma&quot;,&quot;Arial&quot;,&quot;sans-serif&quot;!important;font-size:100%!important;white-space:pre-wrap!important;'>"&[ACT_Memo]&"</pre></span>")) //If [Notes] is less than 300 characters, display [Notes]

    <<<<<<END<<<<<<<

    ------------------------------
    Jan-Willem Speckmann
    ------------------------------