Skip to main content
Question

A formula URL button that adds +1 to a numeric field

  • August 12, 2014
  • 0 replies
  • 200 views

I need help creating a formula URL button. I have an issues/suggestions table. If a user is also having the same issue that has already been submitted I basically want to create a me too or +1 button. When the button is pushed is adds one to the value in the [Number of Votes] field. Thanks in advance for any help!

This topic has been closed for replies.

  • Registered
  • August 13, 2014
In your Issues table:

Numeric field: [Number of Votes] (set the default value to 0, or 1 - as you prefer)

Formula Numeric field: [Next Number of Votes] (formula = [Number of Votes] + 1 )

Formula URL field: [Me Too]

Formula:

var text URLOne = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]

& "&apptoken=XXXXXX"

& "&_fid_YYYY=" & [Next Number of Votes];

var text URLTwo = URLRoot() &"db/" & Dbid() & "?a=dr&rid=" & [Record ID#];

$URLOne & "&rdr=" & URLEncode($URLTwo)

Notes:- replace "XXXXXX" with your application token, YYYY with the field ID of your [Number of Votes] field- URLOne edits the record that the button is sitting on, overwriting the value in [Number of Votes] with the value in [Next Number of Votes] (i.e. fills it in with [Number of Votes] + 1)- URLTwo redirects to the View version of the same record- string URLOne and URLTwo together - and when you press the button, the [Number of Votes] increments, and the page refreshes to the View version of the record

  • Author
  • Registered
  • August 13, 2014
Thank you so much! Worked perfectly! I was close but a couple of things in my formula were off.

  • Registered
  • August 13, 2014
Great - glad it worked for you!

Sorry for reopening an old thread - this formula works great but is there anyway I could change the way the link displays to an image?  

I tried based on the info from the post here: https://quickbase-community.intuit.com/questions/1453788-how-do-you-make-a-forumula-text-button-in-order-to-navigate-to-another-form-with-the-same-record
- but this just messes up the Formula syntax.

I would like the button to click on be a thumbs up icon. Is this possible?

  • Registered
  • December 5, 2016
You'll have to supply the thumbs up icon - at a URL that is accessible by the users in your QuickBase app.

Then:

Create a new Formula URL field - called [Like Button]
with the following formula:

var Text LikeURL = ToText([Me Too]);
var Text ImageURL = "https://images.quickbase.com/si/16/200-add.png";

"<a href='" & $LikeURL & "'>" &
"<img src='" & $ImageURL & "'>" &
"</a>"

This takes the URL from [Me Too], and puts in a HTML link around your image.

You'll need to swap out the ImageURL value with your own image URL.

hmm I just seem to get a> displayed when I do this so I think there is something not quite working - probably I missed something somewhere

There are some tricky single quotes in there - make sure to copy the formula exactly.  You should only need to edit the LikeURL and ImageURL.  Get it working first, and then you can modify from there.

Ah ok sorry - completely new to this. I left the end part unchanged i.e.

"<a href='" & $LikeURL & "'>" &
"<img src='" & $ImageURL & "'>" &
"</a>"

The only part I changed is the  ImageURL and the field as mine is called something else i.e. my final formula looks like this:

var Text LikeURL = ToText([Upvote Record]);
var Text ImageURL = "https://assets.quickbasecdn.net/res/73823-18/js/ckeditor-dev-4.5.8/plugins/smiley/images/thumbs_up.png";

"<a href='" & $LikeURL & "'>" &
"<img src='" & $ImageURL & "'>" &
"</a>"

While I was playing I added the Quickbase smiley image before I figure out where to host mine.

So I need to change the $LikeURL and $ImageURL as well? I presumed these were defined by the previous lines, not sure what I would put here.

Thanks for your help, its been great!

You should only need to change the $LikeURL and $ImageURL.

I just checked what you copied in - it worked for me.

Let's check a couple of things:

Did you create a NEW Formula Text field to put this formula in?  
And checked "Allow some HTML tags to be inserted in the field"?

If you had the same structure as my original example, your [Upvote Record] should be a Formula URL field.  

This new Formula Text field would take that [Upvote Record], and use an image for the link.

Aha - I created it as a new Formula URL field - thats fixed it! Brilliant thanks for all your help

Great!  You're welcome.

Wanted to breathe life back in the post 2 years later.  I have the above coding working perfectly, but I am curious to see if there is a way where the button/image can be clicked and the count recorded without going into the record

Can you explain this

"without going into the record".

Are you asking if the button can be clicked to edit the record without needing to log into Quick Base?


Thanks for the response!

I am logged into Quick Base and on my respective "Enhancements" table in this case.  My "button" is an upvote button.  When I click on the upvote button, it edits the record, but then clicks into the record as well to see the deeper information.

Ideally, I could click the upvote button causing the edit, yet keeping the User on that same view/report, without navigating into the record