A couple of formatting queries

(12 posts) (3 voices)
  1. ajdjackson, Member

    Hi

    I've a couple of queries regarding appearance which I can't find an answer for in docs or demo.

    Is there a way to hide the 'grand total' line when using 'dbr.hdr' and 'dbr.sum'? I wish to show the totals as the header changes but not the overall total.

    How to a create a style/format to convert negative numbers to display as red and in parenthesis? I've seen the 'AlternateColorDecimal_0' style but the printf formats don't have one for parenthesis (I believe).

    Thanks again

    Jake

  2. myDBR Team, Key Master

    For hiding the summary row you can use:

    select 'dbr.css', '.summary_level0 {display:none}';

    For the styling (integers), use:

    select 'dbr.colstyle', 'Column', '%d;0;[color:red](%d)';

    --
    myDBR Team

  3. ajdjackson, Member

    Class - works great!

    Thanks

    Jake

  4. vannc, Member

    Dear myDBR team!

    How can I work with %, If column value > 100% then blue; otherwise, red

    select 'dbr.colstyle', '%', '[color:blue]%0.1f %;100.0;[color:red](%0.1N);';

    I command this but it does not work.
    Thanks team!

  5. myDBR Team, Key Master

    You can use the column style to format nagative, zero, positive and NULL values. To add custom formatting, use the dbr.cellstyle.

    --
    myDBR Team

  6. vannc, Member

    Dear team,

    However, dbr.cellstyle does not apply automatically to the 'Total' column.
    I noticed that dbr.colstyle applies automatically to the 'Total' column.

  7. myDBR Team, Key Master

    You can use dbr.footer.cellstyle with combination of dbr.calc for custom footer cell formatting:

    select 'dbr.sum', 'a', 'b';
    select 'dbr.calc', 'colorA', "[a]>100 ? 'color:blue' : 'color:red'";
    select 'dbr.calc', 'colorB', "[b]>100 ? 'color:blue' : 'color:red'"; select 'dbr.footer.cellstyle', 'a', '[colorA]';
    select 'dbr.footer.cellstyle', 'b', '[colorB]'; select 'A' as 'nane', 10 as 'a', 6 as b, null as colorA, null as colorB
    union
    select 'B', 30, 12, null, null
    union
    select 'B', 80, 13, null, null;

    --
    myDBR Team

  8. vannc, Member

    Dear Team!

    But your example does not work in my case
    https://drive.google.com/file/d/1npShciGXgmmFDTu74lmBa-fcwtyC_l7p/view?usp=sharing
    this is result.

  9. myDBR Team, Key Master

    Double-check your code. See a demo.

    --
    myDBR Team

  10. vannc, Member

    Dear team!

    I don't know where I am wrong; I copied all of your code. Maybe I am using SQL Server?
    myDBR version: myDBR 6.9.1 (build 5073)
    Footer format

  11. myDBR Team, Key Master

    In SQL Server cast the NULL to be a varchar (will be int by default). myDBR will use the datatype for formatting.

    select 'dbr.sum', 'a', 'b';
    select 'dbr.calc', 'colorA', "[a]>100 ? 'color:blue' : 'color:red'";
    select 'dbr.calc', 'colorB', "[b]>100 ? 'color:blue' : 'color:red'"; select 'dbr.footer.cellstyle', 'a', '[colorA]';
    select 'dbr.footer.cellstyle', 'b', '[colorB]'; select 'A' as 'nane', 10 as 'a', 6 as 'b', cast(null as varchar) as 'colorA', cast(null as varchar) as 'colorB'
    union
    select 'B', 30, 12, null, null
    union
    select 'C', 80, 13, null, null;

    --
    myDBR Team

  12. vannc, Member

    Dear team!

    Thanks team, I have done with it! :D


Reply

You must log in to post.