Forum Discussion

18 Replies

  • Go to this ugly chart:

    https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=q&qid=84

    Paste this code into the console:
    var chart = Highcharts.charts[0];
    var options = chart.options;
    chart.destroy();
    options.xAxis[0].categories = _.filter(options.xAxis[0].categories, function(item, index) {
      return index < 10;
    });
    options.xAxis[0].labels.step = 1;
    options.series[0].data = _.filter(options.series[0].data, function(item, index) {
      return index < 10;
    });
    new Highcharts.Chart(options);
    See screenshot of resulting Chart.



    Then apply the Un-HighCharted Waters technique with the above code as described here:

    https://community.quickbase.com/quickbase/topics/what-is-the-hylo-technique

    If you needs additional assistance feel free to contact me off-world using the information in my profile:

    https://getsatisfaction.com/people/dandiebolt
    • EvanMartinez's avatar
      EvanMartinez
      Qrew Elite
      I am actually familiar with the method that Eric used in his demo application for building out something like a top ten report and his method made use of native relationships and summary/lookup fields and a Universal Parent record. Essentially it works best when you have at least two tables to start. In your instance if your client has a table of Customers and each customer has many records related to sales that are being summarized up to the Customer. You then create another table to serve as the home of your Universal Parent record. From there you create a single record and then in your Customers table you create a numeric field and set it to be equal to 1 on all existing records and default to 1 for all new records and use this field as the reference field for your relationship so you have 1 Universal Parent record related to all your customers.

      This way all of your customers are now related to your new parent record and you can start setting up your fields. If you want a top ten for example you create a look up field that is the Max of the field Total Customer Sales, you then set that new summary field as a look up down onto the Customer table. Then when you make your #2 customer summary field and do the Max of Total Customer Sales that are not equal to your #1 Customer look up field and then rinse and repeat till you have 10 summary fields calling up Customer 1-10 and 9 look up fields that you are using in the summary field to help you find the next Max so your last Summary field will be the Max of Total Customer Sales that are not equal to #1 Customer Summary through #9 Customer Summary. As the Customer Total Sales naturally fluctuates over time the relationship will change its order.

      Then the final step is to create a formula field on your Customers table that is called Top Ten Customer ratings with a formula that says something like 

      If([Total Customer Sales]=[#1 Customer Lookup], 1, If([Total Customer Sales]=[#2 Customer Lookup], 2, etc.  
      Until you have your Customer 1-10 now rated by the formula and you set your Chart to show all customers who have a Rating of 1 or greater. It takes a decent amount of architecture that can long term have some possible considerations from a performance standpoint as a data set grows larger but it is possible and wouldn't require any outside scripting or third party services. It is something that you might want to test first in a testing app to make sure it works out the way you would like and to get familiar with the set up.
      • QuickBase7's avatar
        QuickBase7
        Qrew Member
        Hi. Maybe it's just me but having the ability to just list the top 'x' items in a report (tabular or chart) seems to be a very basic function and I'm surprised that QuickBase makes it so complicated. ​For example, at its simplest, one has a  table with 100 customer records and values, say one of those being 'No of orders'. It would be good to show the top 5 customers based on No. of orders on a dashboard using simple coding for the regular user.​

        ------------------------------
        Quick Base
        ------------------------------
    • ArchiveUser's avatar
      ArchiveUser
      Qrew Captain
      Your code gives me this error:

      VM127:2 Uncaught TypeError: Cannot read property 'options' of undefined at <anonymous>:2:20
      (anonymous)@VM127:2
    • Edgar_Solutions's avatar
      Edgar_Solutions
      Qrew Member
      I get this error:

      VM144:2 Uncaught TypeError: Cannot read property 'options' of undefined
          at <anonymous>:2:20
  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    If script is not for strength, you can do this with native relationships and formulas.  It might not always show the top 10, but it will dynamically show your top % of results, and you can set that % to whatever you'd like.
    • _anomDiebolt_'s avatar
      _anomDiebolt_
      Qrew Elite
      >:If script is not for strength

      You are killing me. Why would anyone choose not to use script when it is the universal way to solve QuicBase problems when native either doesn't work or becomes tedious.

      >Can you elaborate on how would I take this route?

      Follow my instructions above as a first step.

      Actually there is a logic error in my script where I just modified the chart to take the first 10 values. I think what you may have wanted requires you to sort the array first and take the ten largest values. This is a simple modification using Underscore's sort() and first() methods .
  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    Sania,

    Can you provide an example of the report you are trying to make? 
    I'm just looking for some of the defining factors that will dictate the needed set up.  
    For example, is it a report of Projects grouped by category, client, or area, etc?

    We will need to summarize all the data, then divide the data by its count so you can have a %, then set a % threshold, but I can provide more details if you have some more info for me.

    .... or you can use a script...  I'm sure Dan would love to help.
    • _anomDiebolt_'s avatar
      _anomDiebolt_
      Qrew Elite
      >I'm sure Dan would love to help.

      Dan busy but I consider this problem solved already. I defy everyone to come up with a well formed problem that can't be solved with scrip! BAM
  • MichelleChapman's avatar
    MichelleChapman
    Qrew Assistant Captain
    Hi Matthew, I know this thread is 2 years old but I have the same question, except trying to draw out the top 5 on a bar chart. I was able to generate the bar chart that rates agent sales from highest to lowest, I just need to be able to display the top 5. Is there a formula I can enter in the chart formula box to display top 5? 
  • JackFretwell's avatar
    JackFretwell
    Qrew Assistant Captain
    I'm seeing an error with the above bar chart code;
    Uncaught TypeError: Cannot set property 'options' of undefined.  
    Has something changed in QB?
    Sure this worked before.