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    

3 comments:

  1. please provide the erp integretion detials

    ReplyDelete
  2. please provide the erp integretion detials

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

    ReplyDelete