Skip to main content
Question

Button Named after data in a field

  • June 23, 2017
  • 0 replies
  • 62 views

I am using a text formula to generate a button and need to do something outside of my skill set. I need the button name to change based on the data in a specific text field. It sounds odd but is actually needed. Here is a sample of the formula.....

// Begin button style
var text bgcolor = "#A5E294";
var text txtcolor = "black";
var text style = "style=\"text-decoration: none;\n\n box-shadow: 3px 3px 1px #888888; \n\n background:" & $bgcolor & ";\n\n border-radius: 3px;\n\n padding: 5px 8px;\n\n color: " & $txtcolor & ";\n\n display: inline-block;\n\n font: bold 700 24px/1 \"Calibri\", sans-serif;\n\n text-align: center;\n\n text-shadow:none;";
// End button style

If([Can work be invoiced?]=false,
"<a " & $style & " href=" &
URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&rid=" & URLEncode ([Record ID#])
& "&_fid_104=1"
& "&_fid_105=1"
& "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=q&qid=128")
& ">Add to Billing</a>"
,"")
This topic has been closed for replies.

  • Quickbase Alumni
  • June 23, 2017
Inorder to change the label name you can use API_SetFieldProperties

https://target_domain/db/target_dbid?a=API_SetFieldProperties&fid=6&label=labelchanged&apptoken=app_token
Examples:

target_domain : sampledev.quickbase.com
target_dbid: Table ID [bjhsda32s]
6: Your field id
labelChanged : get the value of the field
app_token: if you made the app token required 

  • Author
  • Quickbase Alumni
  • June 23, 2017
I guess I wasn't clear, I don't want to change the name of the field just the labeling on the button itself.

  • Quickbase Alumni
  • June 23, 2017
var text value = [LabelName];

If(ToNumber([CheckBox])=1,
URLRoot() & "db/" & Dbid() & "?a=API_SetFieldProperties&rid=" & URLEncode ([Record ID#])
& "&fid=6"& "&label="& $value &" "& "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=q&qid=1")
& ">Add to Billing</a>" 
,"")

LabelName: field which you are entering the new value which should be reflected as label name
6: 
instead of this give your fid of the target field which you want to change

I Hope this will solve your issue

Tested Working for me!!

  • Author
  • Quickbase Alumni
  • June 23, 2017
Your information will help with some future work. The final solution I got for the naming was this:
& "> Add to "&[IRF - Record Name]&"</a>"
I kept making formatting mistakes. Thanks for the help and  hopefully one day I can return the help.