Apply parentheses for cellstyle!

(4 posts) (2 voices)

Tags:

No tags yet.

  1. vannc, Member

    Dear Team,

    I am encountering an issue with applying parentheses for cell styles. I have followed the provided instruction:

    An extension to printf-format (%0.0N for zero decimals, %0.2N for two decimals), myDBR allows formatting negative numbers as positive allowing accountant style formatting (optionally with parentheses). The following format would show the negative numbers as positive, in red wrapped in parentheses. Sorting will still be done with actual values.
    %0.1f;-;[color:red](%0.1N);

    However, this solution does not seem to be working for me. Could you please assist me with this matter?

    SELECT 'dbr.colstyle', 'ty', '%.0f; ;%.0f';
    select 'dbr.cellstyle', 'ty', 'd_style';
    CASE
    WHEN @currencyType = 'USD' THEN
    CASE
    WHEN @priceFormat = 'Thousand' THEN sum(b.recent) / 1000 / @exchange_rate
    WHEN @priceFormat = 'Million' THEN sum(b.recent) / 1000000 / @exchange_rate
    WHEN @priceFormat = 'Billion' THEN sum(b.recent) / 1000000000 / @exchange_rate
    ELSE sum(b.recent) / @exchange_rate
    END
    ELSE
    CASE
    WHEN @priceFormat = 'Thousand' THEN sum(b.recent) / 1000
    WHEN @priceFormat = 'Million' THEN sum(b.recent) / 1000000
    WHEN @priceFormat = 'Billion' THEN sum(b.recent) / 1000000000
    ELSE sum(b.recent)
    END
    END AS 'Actual[ty]',
    CASE
    WHEN sum(b.recent) < 0 THEN '%0.1f;-;[color:red](%0.1N);'
    ELSE 'color:blue;'
    END AS 'd_style'

    Thank you!

  2. vannc, Member

    Dear Team!

    I solved this with dbr.cellformat!

  3. myDBR Team, Key Master

    If the purpose if to show positive numbers in blue with one decimal, zeros with dashes and negative values in parentheses in red, you can just use dbr.colstyle. No need for multiple definitions:

    SELECT 'dbr.colstyle', 'ty', '[color:blue]%.0f;-;[color:red](%0.1N);';

    --
    myDBR Team

  4. vannc, Member

    Wow, thanks team, very brief!

    Best regards!
    Vannc


Reply

You must log in to post.