Monday, January 8, 2018

How to work with Report in CQ / WEM

Use Case: You want to create custom report for any thing in CQ

Prerequisite: Please read very carefully


 What we are covering:

I will give one custom example and guide you how to create report within CQ for your custom requirement.

Q: Where I can find all CQ OOTB reports.
A: You can find them under /etc/reports. You can also navigate to CQ report using siteadmin -> tools-> /reports -> double click on any report

Q: Where is code for OOTB reporting templates and component
A: They can be found under /libs/cq/reporting and API http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/reporting/package-summary.html (I don't think you might have to use these API, Unless there is any specific requirement )

If you read above document very carefully, You will find that not all the reports comes with CQ uses CQ reporting framework. Specially Request log parser report and Disk Usage report.

We will cover CQ reporting example here using CQ reporting framework. For any other report please use example of disk usage or log parser report.

Requirement:

Create CQ report to get Geometrixx product page information. Report should include,

1) Title
2) Tags
3) URL
4) Overview Link
5) Feature Link

You should be able to group report based on Tags. You should also be able to see chart representation of report. You should also be able to export report outside CQ instance.


Solution:

First, Make sure that this can be done using CQ reporting framework. For that go through each field for report and make sure that those are available as properties within that page through "Fix" path and there is no complex logic involve to get that data.

Once you know that this can be done using CQ reports, Start developing report.

Step 1: Create template


  • Create a template for your report. See example under /libs/cq/reporting/templates. 
  • Create node called /apps/cq/reporting/templates
  • Easy is to copy existing report from /libs (I copied user report) to /apps and rename it. In our case I created a report called /apps/cq/reporting/templates/productReport
  • Go to /apps/cq/reporting/templates/productReport/jcr:content/report and assign resource type for your custom report. Also create a property called "rootPath" and assign value as "/content/geometrixx/en/products"
  • Template will look like this.
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
    jcr:description="Geometrixx Product Report"
    jcr:primaryType="cq:Template"
    jcr:title="Geometrixx Product Report"
    allowedPaths="[/etc/reports(/.*)?]"
    ranking="{Long}100"
    shortTitle="Product Report">
    <jcr:content
        jcr:primaryType="cq:PageContent"
        sling:resourceType="cq/reporting/components/reportpage">
        <report
            jcr:primaryType="nt:unstructured"
            sling:resourceType="cq/reporting/components/productreport/productreport"
            repVersion="{Long}2"
            rootPath="/content/geometrixx/en/products"/>
    </jcr:content>
</jcr:root>


Step 2: Create Component

  • You can see example under /libs/cq/reporting/components/<I copied userreport>. Copy directory structure under /cq/reporting/components and rename it as productreport
  • Create / Rename (/libs/cq/reporting/components/userreport/userreport to cq/reporting/components/productreport/productreport)
  • Make sure that you have following nodes, /apps/cq/reporting/components/productreport/productreport/charting for creating chart data for grouped items. /apps/cq/reporting/components/productreport/productreport/dialog for existing report dialogs. /libs/cq/reporting/components/userreport/userreport/queryBuilder to specify query that needs to run against the report.
  • Change /libs/cq/reporting/components/userreport/userreport/queryBuilder, nodeType property to "cq:PageContent". Because your page jcr:content node has all those properties that we are looking for in our report.
  • Please see http://dev.day.com/docs/en/cq/current/developing/developing-reports.html#Query Definition if you want to add additional constraint in query. For example give me only those page whose cq:template value is "Something", In that case you would create something like this
N:queryBuilder
    N:propertyConstraints
    [
        N:N0 // array of nodes (name irrelevant), each with the following properties:
            P:cq:template
            P:something
    ]
    P:nodeTypes cq:PageContent
Step 3: Create all Column

  • Once we have query definition to get all pages, Now you can create column to show in your report.
  • For that see example under /libs/cq/reporting/components/userreport and see how each column is configured.
  • You can copy one column from /libs/cq/reporting/components/userreport under /apps/cq/reporting/components/productreport to start with
  • Description about field for a column can be found here http://dev.day.com/docs/en/cq/current/developing/developing-reports.html#Column Base Component
  • For example in our case, we want a Tag column. for that create /apps/cq/reporting/components/productreport/productreport/Tagcol with following definition
  • Now suppose you want overview page path, for that you have to nevigate to Overview node and then show it. In that case definition would look like this

38 comments:

  1. WINNING303 - JUDI BOLA ONLINE | CASINO ONLINE | SLOT ONLINE | POKER ONLINE TERPERCAYA

    TOGEL POKER

    BO POKER

    TOGEL303

    CASINO303

    BOLA303

    * KUNJUNGI SITUS KAMI DI *

    www.winning303.com


    *NB : MENANG BERAPAPUN, PASTI KAMI BAYAR !!! *

    * Melayani LiveChat 7 x 24 Jam Nonstop :
    - WA : +6281717177303
    - BBM : WINNING303
    - LINE : WINNING303*

    ReplyDelete

  2. DAFTAR ID GRATIS SABUNG AYAM ONLINE


    * KUNJUNGI SITUS KAMI DI *

    WWW.ID303.INFO


    MENANG BERAPAPUN, PASTI KAMI BAYAR !!! *


    * Melayani LiveChat 7 x 24 Jam Nonstop :

    - WA : 08125522303
    - BBM : CSID303



    BONUS JACKPOT SABUNG AYAM ONLINE


    DEPOSIT VIA PULSA

    ReplyDelete
  3. AllAssignmenthelp reviews is best reviews site in US and Australia. We at Top Quality Assignment believe that there is no shortcut to success and to attain success, hard work, dedication, and commitment must be present.
    AllAssignmenthelp reviews
    All Assignment help reviews
    Assignment help reviews
    AllAssignmenthelp.com reviews

    ReplyDelete
  4. My Assignment Services is one such Online Assignment Help provider which provides a helping hand to all your academic related queries. They have a lot of professional experts who are skilful in giving you guidance and providing you with cheap assignment help services. You are free to contact their experts by visiting their website and get your pending presentations completed on the time. Given below are some of the steps that they follow while drafting your assignments. Many students see that Assignment Help UK experts are proficient in writing your assignments but no one wonders the reason behind it. However, students pursuing IT need to understand the concepts of Java because it holds down the concept of object oriented programming. The programming concepts are complex to understand and brings a havoc to students, that is why, My Assignment Services bring you our online assignment help services. Taking out some time to consider and contrast about what options that you have that you can include by writing them on a piece of paper. You can also contact some real time Deakin Referencing Generator experts to assist you with the following topics.

    ReplyDelete
  5. Hey, Your blog is very informative. It is nice to read such high-quality content. Attractive information on your blog, thank you for taking the time and share with us. Myassignmenthelp delivers quality content related to employee motivation assignment writer.

    ReplyDelete
  6. I love to visit your site repeatedly because; here I find all information is very useful and educational for me. online paper editor

    ReplyDelete
  7. Myassignmenthelp have earned the reputation of serving countless students across the globe who have secured excellent grades under our professional guidance. We have a dedicated team of PhD qualified essay writers who are competent enough to provide the best assignment help service, essays and write-ups for the students. Our assignment help company has benefitted customers throughout the world

    ReplyDelete
  8. At Singaporetranslators.com, we have a pool of language writers who have proved them the ACADEMIC TRANSLATION SERVICES SINGAPORE by providing uncountable service to the Singapore’s students. They are highly expertise and professionalism in writing any kind of assignment works.

    ReplyDelete
  9. Allessaywriter.com can provide you all the answers regarding who can "write my essay". In our service, we have some of the best essay typer who are professional in this field. We ensure a high quality work within the stipulated time. Not only that, but our prices are so reasonable that you do not have to peep into your pocket before hiring us.

    ReplyDelete
  10. Thank you for bestowing this information which will enlighten many of us. It’s really helpful for me and the one who wants to know more about mobile application development company USA.

    ReplyDelete
  11. In case you are wondering, “I need someone to help me with my science homework” you must hire our services. Our team of 3000+ experts provides guidance with a wide variety of subjects and covers over 100+ areas of science. Most of our writers are PhD graduates and retired professors with years of experience in dealing with various fields of science subjects. Our experts on science homework helper online provide comprehensive solutions for the subjects listed below:

    ReplyDelete
  12. I love to visit your site repeatedly because; here I find all information is very useful and educational for me.we are Interior Designer in Delhi

    ReplyDelete
  13. Livewebtutors aims at providing the students with a one stop solution for all the academic related issues. The company has Livewebtutors is an online Assignment Help and assignment writing service offering expert assignment help. Hire Australian assignment writing experts.
    visit now:- CDR Report writing

    ReplyDelete
  14. What a brilliant information post its really wonder full article thanks for the sharing these great post Case Study Writing Services Australia.Case Study Assignment Help

    ReplyDelete
  15. Whole Night Package: In the whole night package, you can book the VIP Escorts in Delhi to give you the perfect satisfying experience for the entire night. Yes, they will be charging heftily for the comprehensive whole night package.

    ReplyDelete
  16. Students can easily get amazing accounting assignment help services from the professional experts of StudentsAssignmentHelp.com. We are having best team of experts have gained great knowledge in completing all your task accurately and in the asked format. So, students can easily get the best homework writing services today and score high grades.

    ReplyDelete
  17. Our website AllAssignmenthelp.com is affiliated with the site of various nations. We give our administration everywhere around the world. Our assignment assistance is given to students all through.
    Assignment Help Canada

    ReplyDelete
  18. Thanks a lot for sharing. This amazing post and very informative.
    Homework Help Canada
    Law Assignment Help

    ReplyDelete
  19. Great! This has been an incredibly wonderful post. Many thanks for providing these details. Korean translators

    ReplyDelete
  20. Are you always struggling with assignment so now its time to remove all your stress about assignment help. SingaporeAssignmentHelp have expertise ghostwriter singapore and they are more capable to complete any project management assignment on time at nominal price for betterment of students.

    ReplyDelete
  21. Thank you for sharing this informative post.MyAssignmenthelp.co.uk is giving assignment help to students.we are already trusted by thousands of students who struggle to write their academic papers and also by those students who simply want Online project management Writers to save their time and make life easy.

    ReplyDelete
  22. Assignments have become way more important than students understand. Assignments not only carry a lot of marks, but these are also important to gain knowledge as while writing assignments, you study a lot of other people’s work which can help you to understand topics clearly. However, many students seek Best assignment help from experts due to the many hurdles that they face while writing assignments.

    ReplyDelete
  23. Academic writing subjects help is most trust able homework help from the writers of Singapore Assignment Help. Get cheap assignment help form our writers at affordable price with higher grade in your academics

    ReplyDelete
  24. Working to make such reports is really easy but to be true, whenever you get help from good dissertation writing services, you can easily make a good kind of survival to get things figured out.

    ReplyDelete
  25. hye! thanks for sharing this post. i found it very informative thanks once again
    movers and packers in Thane

    ReplyDelete
  26. I found this post informative and knowledgeable. I would like to thank you for sharing this article
    movers and packers in thane

    ReplyDelete
  27. write my assignment with higher-level academic writer, We deliver top quality solutions for assignments in over 100 subjects with Online Assignment Help. Our tutors focus on providing step-by-step solutions to every assignment problem or write my assignment. If you want to buy assignment help go with our best expert team across the country

    ReplyDelete
  28. Contact to the best Packers and Movers in Mumbai for 100% secured relocation of your house and office, we are the top Packers and Movers Mumbai to relocate bike, car and both. We are the most popular Packer and Mover in Mumbai to install RO, AC and both, we are the top rated Packer and Mover Mumbai to relocate above 3BHK.

    Packers and movers in delhi
    packers and movers in kolkata
    packers and movers in bangalore
    packers and movers in pune
    packers and movers in faridabad
    packers and movers in mumbai
    packers and movers in hyderabad
    packers and movers in noida

    ReplyDelete
  29. Best piece of info ever looking forward for more, having a sparkling clean concrete surface can be difficult at times. It requires a lot of effort and time to clean the tough stains and dirt. However, the cleaning of this stubborn dirt and stains can become easier when you are cleaning with the best concrete cleaner. Get one from Best Concrete Cleaner

    ReplyDelete
  30. Contact to the best Packers and Movers in Hyderabad for 100% secured relocation of your house and office, we are the top Packers and Movers Hyderabad to relocate bike, car and both. We are the most popular Packer and Mover in Hyderabad to install RO, AC and both, we are the top rated Packer and Mover Hyderabad to relocate above 3BHK.
    packers and movers in hyderabad

    ReplyDelete
  31. This comment has been removed by the author.

    ReplyDelete
  32. Excellent information Providing by your Article, thank you for taking the time to share with us such a nice article. Amazing insight you have on this, it's nice to find a website that details so much information about different artists. Kindly visit the LiveWebTutors website we providing the best assignment help services in Australia.

    for more info: Assignment Writing Services

    ReplyDelete