Generating reports withthe Forena module
Session topicsIntroThe Forena module itselfRCN2: project to create reports forReal life samplesQ&A
IntroductonForena: one of hidden gemsCould be an alternative for ViewsVersion 7.xSession outcome for visitors
The Forena Reports moduleAllows to generate reports when you have SQL to get datafrom DB;Actually, this might be not onl...
Sample reportDataSQLFormat
Sample reportDataSQLFormat--ACCESS=access demo reportsselect * from statesORDER BY nameDataSQLDataSQL
DataSQLFormat<body><div frx:block="sampledb/states" id="forena-1"><table><thead><tr><th>code</th><th>name</th></tr></thead...
Need more?1) Field modifiers:<frx:field id="date"format="iso_date"format-string="Y-m-d"/><frx:field id="total_cost"format=...
Need more?1) Field modifiers;2) Parameters in SQL:... WHERE j.job_id_pk = :job_id3) Formatters
Need more?1) Field modifiers;2) Parameters in SQL;3) Formatters:natively provided export to popular formats likeCSV, XML, ...
RCN2: a few words about theapplied projectIntranet ERP system;Complex business logic;Shared database with a few other s...
RCN2: Postgres related infoDatasets arent huge but diversed — theresmany specialized heavily linked tables;Active usage ...
SolutionViews/Custom pages/Forena reports —approximately 20% - 20% - 60%;About 80 *.frx files on production website;
Real life report SQLs – 1/3Your SQL can be complicated: i.e. some kinky WITH()--ACCESS=can access reportsWITH base_model_i...
Real life report SQLs – 2/3Mighty WHEN-THEN-ELSE, JOINS and GROUP BYs... FROM v_job_latest_statusINNER JOIN v_jobs_no_cont...
Real life report SQLs – 3/3Brutal UNION and all that jazz together... from v_cost_reportwhere group_id = :gl_groupunionsel...
Hints and linkshttp://drupal.org/project/forena7.x-3.4 is out, weve spoken about 7.x-2.x(supporting SVGGraph, etc)Could...
About meArea of interests and expertise:Backend programming;Drupal as a CMF;Aegir, Mediamosa;Troubleshooting.
Questions?dennis.povshedny@gmail.com+38 096 2323 346http://drupal.org/user/117896www.slideshare.net/workingdaywww.linkedin...
Upcoming SlideShare
Loading in …5
×

Drupal CMS: generating reports with the Forena module.

6,546 views

Published on

Slides for my speech on Drupal Camp Kyiv 2013.

Idea is to introduce to the Drupal programmers/users the alternative way of building reports, including complicated ones.

Showcase is about the Forena Reports Drupal custom module.

Published in: Technology, Business
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
6,546
On SlideShare
0
From Embeds
0
Number of Embeds
424
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Drupal CMS: generating reports with the Forena module.

  1. 1. Generating reports withthe Forena module
  2. 2. Session topicsIntroThe Forena module itselfRCN2: project to create reports forReal life samplesQ&A
  3. 3. IntroductonForena: one of hidden gemsCould be an alternative for ViewsVersion 7.xSession outcome for visitors
  4. 4. The Forena Reports moduleAllows to generate reports when you have SQL to get datafrom DB;Actually, this might be not only Drupal DB;… and even not only database;Report consists from 2 parts — SQL and kind of extendedHTML;Included nice sample reports in the package;Have a several video screencasts in English;About ¾ of potentially custom reports can be done withForena
  5. 5. Sample reportDataSQLFormat
  6. 6. Sample reportDataSQLFormat--ACCESS=access demo reportsselect * from statesORDER BY nameDataSQLDataSQL
  7. 7. DataSQLFormat<body><div frx:block="sampledb/states" id="forena-1"><table><thead><tr><th>code</th><th>name</th></tr></thead><tbody><tr frx:foreach="*" id="forena-2" class="test {code}"><td>{code}</td><td>{name}</td></tr></tbody></table></div></body>
  8. 8. Need more?1) Field modifiers:<frx:field id="date"format="iso_date"format-string="Y-m-d"/><frx:field id="total_cost"format="php"format-string="returnRcnFormats::currency_format($value);"/>2) Parameters;3) Formatters
  9. 9. Need more?1) Field modifiers;2) Parameters in SQL:... WHERE j.job_id_pk = :job_id3) Formatters
  10. 10. Need more?1) Field modifiers;2) Parameters in SQL;3) Formatters:natively provided export to popular formats likeCSV, XML, … :<frx:docgen><frx:doc type="..."/></frx:docgen>
  11. 11. RCN2: a few words about theapplied projectIntranet ERP system;Complex business logic;Shared database with a few other systems;Reporting is one of crucial parts;
  12. 12. RCN2: Postgres related infoDatasets arent huge but diversed — theresmany specialized heavily linked tables;Active usage of Postgres-specific features;
  13. 13. SolutionViews/Custom pages/Forena reports —approximately 20% - 20% - 60%;About 80 *.frx files on production website;
  14. 14. Real life report SQLs – 1/3Your SQL can be complicated: i.e. some kinky WITH()--ACCESS=can access reportsWITH base_model_info as (SELECT m.model_desc base_model,m.model_id_pk estimate_model_id,mc.model_component_id_pk model_component_id_pkFROM model_components mc JOIN models mON(mc.model_id_fk = m.model_id_pk)WHERE model_component_type = Base)SELECTc.composite_id_pk Composite_ID,c.composite_desc Composite_Description,bmi.base_model Base_Model...
  15. 15. Real life report SQLs – 2/3Mighty WHEN-THEN-ELSE, JOINS and GROUP BYs... FROM v_job_latest_statusINNER JOIN v_jobs_no_contract_value j ON v_job_latest_status.job_id_fk =j.job_id_pkLEFT JOIN v_jobmst jm ON j.rdms_job_number = jm.job_numberLEFT JOIN (SELECT job_id,SUM(COALESCE(amount, 0) *CASEWHEN amount_key_name = debit_nett_amount ORamount_key_name = amount_excl_gstTHEN 1WHEN amount_key_name = credit_nett_amount ORamount_key_name = credit_net_amount THEN -1ELSE 0END) AS expenditureFROM v_job_order_expenditureGROUP BY job_id) AS e ON e.job_id = j.job_id_pkLEFT JOIN ( ...
  16. 16. Real life report SQLs – 3/3Brutal UNION and all that jazz together... from v_cost_reportwhere group_id = :gl_groupunionselect cast(category_id as text) as ordering , header asrowtype, null as job_number, null as supplier_name,null as invoice_number, null as invoice_date, category_name astransaction_description, cast(null as numeric) as amountfrom v_cost_reportwhere group_id = :gl_groupand effective_date > :from_dateand effective_date < :to_dateunionselect category_id||-z as ordering , cat total asrowtype,null as job_number, null as supplier_name, ...
  17. 17. Hints and linkshttp://drupal.org/project/forena7.x-3.4 is out, weve spoken about 7.x-2.x(supporting SVGGraph, etc)Could be a good step from 7.x to 8.x
  18. 18. About meArea of interests and expertise:Backend programming;Drupal as a CMF;Aegir, Mediamosa;Troubleshooting.
  19. 19. Questions?dennis.povshedny@gmail.com+38 096 2323 346http://drupal.org/user/117896www.slideshare.net/workingdaywww.linkedin.com/in/1dennis1

×