Forum Discussion

EmberKrumwied's avatar
EmberKrumwied
Qrew Assistant Captain
27 days ago

Format Formula URL field

I have a formula url field that I'd like to show nothing or be blank if fid 6 (Status) = In or if Out show as a red button that says "Clock Out". Below is the current formula url field that I'm trying to modify.

var text URL = URLRoot() & "db/" & [_DBID_TIME_IN_OUT] & "?act=API_EditRecord"
& "&rid=" & [Record ID#]
& "&_fid_6=Out";

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

$URL
& "&rdr=" & URLEncode($RefreshPage)

I've been looking at various posts that use additional variables to set the formatting, but I'm not sure how to incorporate what I've found into the above.

If Status = Out then use:

var text red = "<a style=\" text-decoration: none; background: #ff0000; border-radius: 5px; color: #fff; display: inline-block; width: 150px; text-align: center; padding: 8px 20px; font: normal 700 14px/1 \"Calibri\", sans-seif; text-shadow: none; \">Clock Out"</a>";

If Status - In then use:

var text white = "<a style=\" text-decoration: none; background: #ffffff; border-radius: 5px; color: #000000; display: inline-block; width: 150px; text-align: center; padding: 8px 20px; font: normal 700 14px/1 \"Calibri\", sans-seif; text-shadow: none; \">Clocked Out"</a>";

  • Thank you for the suggestion. Between what you posted and other references I found I was able to get this field formula to work as intended.

    Thanks

2 Replies

  • It will have to be a formula rich text button to achieve that. Lots of ways to do it, but here is one way:

    var text URL = Put your URL here;
    var text ButtonWords = "Put your Buttons Words Here";

    var text STYLE = 
    "text-decoration:none;" & 
    "background: #0a0ef5;" & 
    "border-radius: 2px;" & 
    "color: #ffffff;" &
    "display: inline-block;" &  
    "width: 150px;" &                     
    "padding: 6px 16px;" & 
    "text-align: center;" & 
    "text-shadow: none;" & 
    "border: 0px solid #1ba802;" &
    "font-size: 12px;";

    "<a  title='This text will show when hovering over button'  style='" & $STYLE & "' href='"
    & $URL
    & "'>" & $ButtonWords & "</a>"

    In your case, you would make an if statement for your buttons words (If(some condition, "Clock In","Clock Out"). Also, would make two style variables ($ClockInStyle and $ClockOutStyle, then maybe a 3rd style variable $FinalStyle = Same If condition for words. Use that Final Style in the button code

     

  • EmberKrumwied's avatar
    EmberKrumwied
    Qrew Assistant Captain

    Thank you for the suggestion. Between what you posted and other references I found I was able to get this field formula to work as intended.

    Thanks