Skip to main content
Solved

Format Formula URL field

  • June 24, 2024
  • 0 replies
  • 247 views

EmberKrumwied
Forum|alt.badge.img+13

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>";

Best answer by EmberKrumwied

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

Forum|alt.badge.img+16
  • Quickbase Alumni
  • June 24, 2024

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
Forum|alt.badge.img+13
  • Author
  • Quickbase Alumni
  • Answer
  • July 8, 2024

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