Sum column

(8 posts) (2 voices)

Tags:

No tags yet.

  1. bushraj, Member

    Hey ,

    1. I want to show sum of that column on the top or in the beginning , instead of showing in the end of column

    2. Second, i want to highlight the row having the max count from that column

    Thanks.

  2. myDBR Team, Key Master

    Hi,
    The summary rows appear in the end by default. You can move it to top using simple JavaScript statement.

    Row highlite can be done with dbr.rowstyle-command.

    --
    myDBR Team

  3. bushraj, Member

    From which Javascript statement?

  4. bushraj, Member

    plus i managed to add the style to a row .. but how can i add style max row command?

  5. myDBR Team, Key Master

    As said, having summary rows appear in the top is not a supported feature. However, you can make that happen quite easily using JavaScript.

    Add a class to the resultset:

    select 'dbr.resultclass', 'myresult';

    and then add the code which will move the summary row to top:

    select 'dbr.javascript', '$(".myresult tbody tr:first").before($(".myresult .SummaryRow"));', 'onload';

    You may have to disable sorting for the particular result set as the sorting algorithm will sort the summary row back to bottom.

    --
    myDBR Team

  6. myDBR Team, Key Master

    plus i managed to add the style to a row .. but how can i add style max row command?

    Calculate first what is the max-row based on your criteria. Then make the query and mark the particular row with the style.

    --
    myDBR Team

  7. bushraj, Member

    My code is:

    select 'dbr.hidecolumn', 3;

    select 'dbr.rowstyle','myresult';
    select 'dbr.sum',1;
    select 'dbr.max',1 ;
    select 'dbr.resultclass', 'myresult';
    select 'dbr.javascript', '$(".myresult tbody tr:first").before($(".myresult .SummaryRow"));' , 'onload';

    Select Count(*) as Total Call IDs, current Status as CurrentStatus

    From rpworkflow.all_issues_modified rp, wf_workflow.tps_lut_organizations o
    where o.organization=rp.Organization
    AND o.Country_ID not in ('PK')
    and rp.Current Status not in ('close', 'Veritas Investigation Closed','Not Submitted YET')
    and product in ('Phoenix')
    group by 2
    order by 1;

    Now how can i apply style to max row or the row which is on top having sum and max which is :

    select 'dbr.javascript', '$(".myresult tbody tr:first").before($(".myresult .SummaryRow"));' , 'onload';

    Kindly help i m stuck!

  8. myDBR Team, Key Master

    Take a look at the dbr.rowstyle-command from the documentation. The parameter to command refers to the column the rowstyle is to be found. In your example there is no column named 'myresult'.

    To highlite the row which has the highest value, you calculate first what row has the highest value and then place the highlite style into that row's dbr.rowstyle column.

    --
    myDBR Team


Reply

You must log in to post.