Wednesday 29 June 2016

hybris-Config iReport tool to build jasperreport

Here is the step by step to create jasperreport by iReport tool and use in Hybris.

1. Download iReportDesigner
http://community.jaspersoft.com/project/ireport-designer

2.Open iReportDesigner,
Add Classpath: Tools > Option > Classpath, add
[hybris home]\ext-platform-optional\virtualjdbc\bin\virtualjdbcserver.jar
[hybris home]\ext-platform-optional\virtualjdbc\lib\vjdbc.jar
[hybris home]\ext-platform-optional\cockpit\bin\cockpitserver.jar

3. New a DataSource with these information
JDBC Driver: de.hybris.vjdbc.VirtualDriver
JDBC URL: jdbc:hybris:sql:http://localhost:9001/virtualjdbc/service
Username: admin 
Password: nimda 
(It is hybris username, not DB username)

Click Test button, it should be connect successfully ( If not, check if Hybris is running)

4. Create a sample report
 In iReportDesigner, File -> New -> Blank A4 Template
Click the button "Report Query" , write a sample Query (it can be normal SQL query or it can be a Flexible query)

For example:  SELECT {p.code}, {p.name}, {p.description} FROM {Product AS p}
Then we will drap and drop the Column name into Detail Section, define header and ajust text if you want
**** To create parameter for report
In left panel, select Parameters -> Add.
****Note: In iReport Designer 5.5  we have "uuid" arrtibute, we should remove it before upload into hybris (in Notepad++, replace by expression uuid=".*" with space)

To import *.*.jrxml into Hybris, we have 2 options:

1. Create widget in ReportCockpit,then upload file .jrxml
http://localhost:9001/reportcockpit/index.zul
2. User impex file to import:
The format impex file as following:

# Language
$lang=en

$defaultCatalog=Default
$defaultCatalogVersion=Staged
$catalogVersion=catalogVersion(catalog(id[default='$defaultCatalog']),version[default='$defaultCatalogVersion'])[unique=true,default='$defaultCatalog:$defaultCatalogVersion']
$jasperreports_folder=jasperreports
$reportPath=jar:com.microsoft.store.cn.cockpits.setup.CockpitSystemSetup&/msscncockpits/reportcockpit/reports/sqlserver

INSERT_UPDATE JasperMedia;code[unique=true];realfilename;@media[translator=de.hybris.platform.impex.jalo.media.MediaDataTranslator][forceWrite=true];folder(qualifier)[default=$jasperreports_folder];icon(code)[default=icon_jasperreport_wizard];$catalogVersion;mime[default='text/xml']
;MSCS-4015-Coupon1600Report;MSCS-4015-Coupon1600Report.jrxml;$reportPath/MSCS-4015-Coupon1600Report.jrxml


# Create Countries
UPDATE JasperMedia;code[unique=true];$catalogVersion;title[lang=$lang];reportDescription[lang=$lang];description
 ;MSCS-4015-Coupon1600Report;;"MSCS-4015-Coupon1600Report";"This widget displays orders which have been applied 1600 CNY Coupon";"MSCS-4015-Coupon1600Report"
5.  work is done    

4 comments:

  1. Hello !
    Welcome to the "Directory Blogspot"
    We are pleased to accept your blog in the division: INDIA
    with the number: 495
    We hope that you will know our website from you friends,
    Invite your friends by giving them the "Directory award"
    This is the only way to expand the site.
    The activity is only friendly
    Important! Remember to follow our blog. thank you
    Have a great day
    friendly
    Chris
    For other bloggers who read this text come-register
    http://world-directory-sweetmelody.blogspot.com/
    Imperative to follow our blog to validate your registration
    Thank you for your understanding
    ++++
    Get a special price "Directory award" for your blog! with compliments
    Best Regards
    Chris
    A pleasure to offer you a degree for your site
    http://nsm08.casimages.com/img/2015/04/22//15042212171618874513195366.png

    ReplyDelete
  2. please provide the erp integretion detials

    ReplyDelete
  3. please provide the erp integretion detials

    ReplyDelete
  4. super information provided in u r blog its most usefull for all entry level developers
    sir ..

    ReplyDelete