how to add page view count at the bottom of page and how to add like and dislike button

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

hi,

i am trying to create QB to update documents for my team which can be used on day to day work using Document Library Application.https://intuitcorp.quickbase.com/db/main?a=AppDetail&ID=293&app_name=Document%20Library

can you help me add page view count at bottom and Like and Dislike Button at top.


Photo of Ankur

Ankur

  • 0 Points

Posted 4 years ago

  • 0
  • 1
Photo of Scott

Scott

  • 334 Points 250 badge 2x thumb
Hello!

This can be easily achieved with the use of dandiebolt's image onload technique.  Found here: https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=294

Once you get it set up, you would simply set up a bit of code that would detect what page you're on and then execute another bit of code depending on that.  Found here: https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=293

Here's the logic, if on X page then use QB API to increment field page_counter by 1.  

As for likes/dislikes, a simple formula URL setup as a button that uses QB API to increment/decrement field likes by 1 or -1.   

Sorry that I don't have the time to actually type out all the code for you, but the logic to it all is above!  Hopefully I'll get more free time later and I'll edit in actual code.

Regards,

Scott
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,064 Points 20k badge 2x thumb
View an individual record and click the Bump It Up button:

Count on Me Discography
https://haversineconsulting.quickbase.com/db/bj839zj5t?a=td

Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=449

Notes

(1) This example will only work in Chrome as I used a ES6 feature in the script called Object Literal Computed Property Key as I wanted to make the script as short as possible. However, it is trivial to remove this feature and use ES5 JavaScript.

(2) I only implemented the counting feature on the view record page but it can be applied on other pages if the workflow makes sense.

(3) Counting the number of times (a) a record is viewed, (b) liked/disliked or (c) how many times a file attachment is opened or downloaded can all be achieved using a variant of this basic technique.

(4) This code is shorter because I eliminated the intermediates promise variables and chained the promises returned by the AJAX calls together by calling *.then(...).
Photo of AcornNut

AcornNut

  • 30 Points
Although, I understand the logic behind it, I'm a complete novice at API Calls. I would like to have a counter that automatically increments +1 every time the record is viewed in "Display Record Page". Any way you can post the code for a field page counter as mentioned above?