Custom Home Page Widgets

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
Has anyone had success with creating their own custom widgets for the standard Quickbase Home Page?

I would like to add buttons on the home page that:
  1. Serves as a link to a specific report
  2. Shows the total number of records in said report



Thank you,
Photo of William

William

  • 162 Points 100 badge 2x thumb

Posted 2 years ago

  • 0
  • 1
Photo of Chuck Grigsby

Chuck Grigsby

  • 2,100 Points 2k badge 2x thumb
In the settings of a homepage you can create a button bar. Those buttons can go to a link, report, or page. If you wanted to add a count or run any query on the home page and add that to the button you may need custom code. 
Photo of William

William

  • 162 Points 100 badge 2x thumb
Thank you Chuck,

I think a custom code option is the way to go.

I have successfully embedded an HTML page on the Quickbase home page that includes the buttons I want.

Where I am having difficulties is with using the response from API_GetNumRecords.

After that I then have to figure out how to apply a filter to the API call.

Any experience?

Photo of Chuck Grigsby

Chuck Grigsby

  • 2,100 Points 2k badge 2x thumb
Ok I think you just want to use API_DoQuery instead of API_GetNumRecords. That will just return the total records of a table. An example is below though it's not tested. For Query or (q) in the code. You would place something like this given 25 is the field ID for a field called status and one of the values is Open
var q = "{25.EX.'Open'}"
 
                    $.get(dbidTracts, {
                        act: "API_DoQuery",
                        query: q,
                        clist: clist
                    }, function(xml) {
$("#openBtn").html("Open Tickets (" +xml.length + ")");
})


You're welcome to reach out directly if you have any questions with custom coding issues. Chuck@Chuck.Support or if this solution resolves your issue and you're feeling gratuitous , chuck.support/donate

Take care and good luck! 

Photo of William

William

  • 162 Points 100 badge 2x thumb
Hello Chuck,

I have tried experimenting with this but am not sure I know where to start. Were is the table referenced in this code?
Photo of Chuck Grigsby

Chuck Grigsby

  • 2,100 Points 2k badge 2x thumb
In this example its called dbidTracts which is just a variable so you can just go to your table, copy the ID from the URL and use that instead or store it in a variable like I did.

I don't know your level of coding so I'm not sure what all you would need help with. For the query code you would also wrap that in <script></script> tags if you enter it in your HTML that's loading the buttons.
Photo of William

William

  • 162 Points 100 badge 2x thumb
I thought my coding skills were adequate until trying to figure this out.

Should I be saving this in an .HTML file?
How do I use the value of xml.length?
Why use an openBtn instead of a "<a>" tag?
Photo of Chuck Grigsby

Chuck Grigsby

  • 2,100 Points 2k badge 2x thumb
You could use <a> and style it or use <button> the styling is just CSS.  You said you had the HTML already with the buttons you wanted. I don't know if you're using <button> or <a> though it doesn't matter. As long as the element has an ID called "openBtn" or something else. $("#openBtn") is jQuery and grabs the element. the .HTML("Some button name") is the info between the tags <button>Some button Name</button>

Not sure I can provide any more help without charging unfortunately. Though I could show you how I do it if you want to learn I can just do one button and you could basically copy/paste for as many buttons as you want.
Photo of William

William

  • 162 Points 100 badge 2x thumb
Let's talk offline