DBR.calc Export to Excel

(3 posts) (2 voices)
  1. nbisby, Member

    I'm using DBR.calc to get a total, and a percentage of the total. It is working great on the web view and export to pdf.

    However, when exporting to excel/csv, anytime dbr.calc would result in 0, it returns the rownumber instead of 0. Most of our users prefer the excel format for their reports... which creates some pretty major issues on our end.

    Screenshot with differences highlighted

    select 'dbr.hdr', '[type]'; select 'dbr.colstyle', '[a_pct]', '%.2f%%'; select 'dbr.colstyle', '[b_pct]', '%.2f%%'; select 'dbr.summary.text', '[type]', 'Total' ; select 'dbr.calc', '[a_pct]','[a]/([a]+[b])*100'; select 'dbr.calc', '[b_pct]','[b]/([a]+[b])*100'; select 'dbr.calc', '[total]','[a]+[b]'; select 'dbr.sum', '[a]', '[b]' ;

    select cat_type as "Type[type]", cat_category as "Category[category]", IFNULL(a_count, 0) as "A[a]", null as "A %[a_pct]", IFNULL(b_count, 0) as "B[b]", null as "B %[b_pct]", null as "Total[total]" from mydb.mydbr_calc_test;

    I was able to fix the percents by simply changing it to use sql to explicitly declare the formula... but that doesn't fix the summary rows (and I prefer the dbr format vs sql).

    Any advice/help would be greatly appreciated.

  2. myDBR Team, Key Master

    You can run the updater to get the latest build which contains a fix for this.

    Btw, you do not need to use [] on all cases, only on those that otherwise would be hard to parse by myDBR. You can write:

    select 'dbr.sum', 'a', 'b' ;

    and myDBR will be ok with it.

    myDBR Team

  3. nbisby, Member

    Awesome, good to know about the usage of []. I was playing it safe and using them everywhere.

    Now on build 1466 (was on 1465) it works!

    Appreciate the help very much!


You must log in to post.