No announcement yet.

filtering in the summary

  • Filter
  • Time
  • Show
Clear All
new posts

  • filtering in the summary


    The issue at hand
    I am trying to create a dashboard application, that - amongst other things - tries to display the summary of a grid. Or to be more specific, the diagramm of a summary. The summarized property is the total count of occurances of a grouped-by field. The thing is, I want to only display the top five occurances (there are hundreds of them, most of them marginal, making the chart unreadable). Basically, I'd love to have a pie chart that shows the top five occurances and adds a sixth category ("others"), that shows the accumulated number of occurances for all others.
    Is there any way to do that with the available tools or do I have to dig into the code?
    If code it is, any pointers that might help me get started? I'm still a beginner at PHP coding.

    Further refinements
    I'll need to do the same for grids with nested grids, based on
    - number of linked items on that nested grids
    - number of different properties in a field of those nested grids (Lets say the nested grid has a field named "name" and I want the number of different names).
    Now I seriously doubt scriptcase can do this for me out of the box, but rather that I'll have to get into coding.
    So here's the big question: Is it easier to do this within scriptcase, or will I be better off creating a custom database with tables for each value that I'll fill with a system service?
    Personally I'm inclined towards the custom database, as the calculations take some time (big tables with lots of data) which would slow down loading time, but having it all in one box would be nice as well, if there's a way to make it work with a justifyable amount of work.


  • #2
    Well, the SQL would be 'fairly' simple....

    SELECT gbField, count(gbField) AS counttotal FROM table ORDER BY counttotal DESC GROUP BY gbField LIMIT 5

    You will probably have to make some adjustments to the SQL, since I have not tested it. But this is how I would approach it. If you have an index on gbField, this should be a fairly quick query.



    • #3
      Hi Nick,

      thanks for the advice, got me rolling towards SQL, which opened up a lot more possibilities.
      Lot's to learn, little time to do it in ... the usual in IT I guess.
      Thanks again, I'll be fine (probably),