Thursday 15 June 2017

Oracle XE listener issue fixing when changing Windows 10 system/computer name


Change the host name with your computer name or localhost in below two files
listener.ora and
tnsnames.ora

Navigation path to the files :
C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN

Now, from the windows services, restart OracleXETNSListener and try connecting to XE SID as shown in below image.

Username : sys , Password : tiger (that is given at the time of installation)

Default password is : sysdba for sys user to connect to xe




The reason for changing host name in my case : 
Recently, I have changed the windows 10  system name and from that point of time, I didn't start oracle db in local but today when I started the oracle db and the listener, the connection for xe SID with sys/tiger credentials not worked.

listener.ora

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = INISAH)(PORT = 1521))
    )
  )

DEFAULT_SERVICE_LISTENER = (XE)


tnsnames.ora
XE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = INISAH)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
  )

EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )

ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )


Wednesday 14 June 2017

High Charts (HTML-5) Horizontal Bar Chart (Column Chart) advanced properties in jasper reports

Horizontal Bar Chart advanced properties

plotOptions.series.dataLabels.align = right
plotOptions.series.dataLabels.color=white
series.dataLabels.enabled=true
series.dataLabels.format={point.y:.1f}%
tooltip.valueDecimals=new Integer(2)
tooltip.valueSuffix=%



Sample output

Sample JRXML (Supported version : 6.2 Pro or later)
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0  -->
<!-- 2017-06-14T01:55:03 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Bar Chart" pageWidth="1000" pageHeight="842" columnWidth="960" leftMargin="20" rightMargin="20" topMargin="50" bottomMargin="20" uuid="9078ded8-657e-41b9-8a90-552bcd773149">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="sumtotal_anjan"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="ireport.jasperserver.url" value="http://localhost:8081/jasperserver-pro/"/>
<property name="ireport.jasperserver.user" value="superuser"/>
<property name="ireport.jasperserver.report.resource" value="/Work/Bar_Chart_for_blog_files/main_jrxml"/>
<property name="ireport.jasperserver.reportUnit" value="/Work/Bar_Chart_for_blog"/>
<queryString>
<![CDATA[SELECT productDescription, buyprice FROM classicmodels.products limit 10]]>
</queryString>
<field name="productDescription" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="buyprice" class="java.math.BigDecimal">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<summary>
<band height="542">
<componentElement>
<reportElement x="0" y="0" width="960" height="542" uuid="40b3d848-171b-4e69-97f5-4f1d8868a7c3"/>
<hc:chart xmlns:hc="http://jaspersoft.com/highcharts" xsi:schemaLocation="http://jaspersoft.com/highcharts http://jaspersoft.com/schema/highcharts.xsd" type="Bar">
<hc:chartSetting name="default">
<hc:chartProperty name="chart.zoomType">
<hc:propertyExpression><![CDATA["xy"]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="colors">
<hc:propertyExpression><![CDATA[java.util.Arrays.asList("#FF0000","#434348","#90ed7d","#f7a35c","#8085e9","#f15c80","#e4d354","#2b908f","#f45b5b","#91e8e1")]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="credits.enabled">
<hc:propertyExpression><![CDATA[false]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="credits.href">
<hc:propertyExpression><![CDATA[""]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="credits.text">
<hc:propertyExpression><![CDATA[""]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="plotOptions.series.dataLabels.align" value="right"/>
<hc:chartProperty name="plotOptions.series.dataLabels.color" value="#FFFFFF"/>
<hc:chartProperty name="series.dataLabels.enabled" value="true"/>
<hc:chartProperty name="series.dataLabels.format" value="{point.y:.1f}%"/>
<hc:chartProperty name="title.text">
<hc:propertyExpression><![CDATA[""]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="tooltip.useHTML">
<hc:propertyExpression><![CDATA[Boolean.TRUE]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="tooltip.valueDecimals">
<hc:propertyExpression><![CDATA[new Integer(2)]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="tooltip.valuePrefix">
<hc:propertyExpression><![CDATA[""]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="tooltip.valueSuffix">
<hc:propertyExpression><![CDATA["%"]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="xAxis.scrollbar.enabled" value="true"/>
<hc:chartProperty name="yAxis.title.text">
<hc:propertyExpression><![CDATA[""]]></hc:propertyExpression>
</hc:chartProperty>
</hc:chartSetting>
<multiAxisData>
<multiAxisDataset/>
<dataAxis axis="Rows">
<axisLevel name="Level1">
<labelExpression><![CDATA["Level Label expression"]]></labelExpression>
<axisLevelBucket class="java.lang.String">
<bucketExpression><![CDATA[$F{productDescription}]]></bucketExpression>
</axisLevelBucket>
</axisLevel>
</dataAxis>
<dataAxis axis="Columns"/>
<multiAxisMeasure name="Measure1" class="java.lang.Double" calculation="Nothing">
<labelExpression><![CDATA["Description"]]></labelExpression>
<valueExpression><![CDATA[$F{buyprice}]]></valueExpression>
</multiAxisMeasure>
</multiAxisData>
<hc:series name="Measure1"/>
</hc:chart>
</componentElement>
</band>
</summary>
</jasperReport>

Thursday 8 June 2017

Tip : Adding email hyperlink on text field in Jasper Reports

Hi,

Do get the email box opened on clicking of email type field in report output, it is required to
set below on the field/string type variable in cross tab.

Link Target = Self
Link Type = Reference
Hyperlink Reference Expression = "mailto:"+$V{EmpEmail} where EmpEmail is the string type of variable in cross tab (or it can be any text field on bands or table component)

Example : 2 : "mailto:"+$F{employeeEmail}



Reference: 
https://stackoverflow.com/questions/27239882/how-to-add-email-hyperlink-in-ireport


Thanks
Sadakar

Wednesday 7 June 2017

Tip : Adding Text/Static Text labels in Cross Tab Header in Jasper Reports

Hello Folks,

When you design a cross tab in jasper reports, by default the cross tab header will not allow you to resize the dragged text fields or static fields to give row group label names. To overcome this

Do as shown in below

Select the "cross tab header" from its outline, and add "Free Layout" from "Arrange In Container" .




Now, drag and drop text field in tot the container, now the header supports adjusting widths of text fields. 




Reference : 
https://stackoverflow.com/questions/37742859/how-to-add-row-header-to-crosstab

Monday 5 June 2017

Tip: Calculate, first date of the given date , the day of the first date and return 0,1,2,3... for Sun, Mon, Tue,Wed and etc. in Jasper Reports

Calculate, first date of the given date , the day of the first date and return 0,1,2,3... for Sun, Mon, Tue,Wed and etc.



JRXML : Copy paste below code in a JRXML file and preview the report.
(Supports in 6.x CE & Pro Studio)

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.3.1.final using JasperReports Library version 6.3.1  -->
<!-- 2017-06-05T22:43:54 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="demo_calendar" columnCount="7" printOrder="Horizontal" pageWidth="1500" pageHeight="612" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="211" leftMargin="11" rightMargin="11" topMargin="10" bottomMargin="10" uuid="32abf871-39b8-4cc7-b03c-d950a55e2bfb">
 <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
 <property name="com.jaspersoft.studio.data.defaultdataadapter" value="foodmart"/>
 <property name="com.jaspersoft.studio.unit." value="pixel"/>
 <property name="ireport.jasperserver.url" value="http://localhost:8081/jasperserver-pro/"/>
 <property name="ireport.jasperserver.user" value="superuser"/>
 <property name="ireport.jasperserver.report.resource" value="/Work/EarthlySystem/Reports/CalenderReport_files/main_jrxml"/>
 <property name="ireport.jasperserver.reportUnit" value="/Work/EarthlySystem/Reports/CalenderReport"/>
 <style name="Style1" forecolor="#050505">
  <conditionalStyle>
   <conditionExpression><![CDATA[$F{id}.intValue()%7==1]]></conditionExpression>
   <style forecolor="#FA0702"/>
  </conditionalStyle>
 </style>
 <parameter name="Date" class="java.util.Date">
  <defaultValueExpression><![CDATA[new Date()]]></defaultValueExpression>
 </parameter>
 <parameter name="FirstDateOfMonth" class="java.lang.String" isForPrompting="false">
  <defaultValueExpression><![CDATA[new SimpleDateFormat("MM/dd/yyyy").format(java.util.Date.parse(MONTH($P{Date}) + "/1/" + YEAR($P{Date})))]]></defaultValueExpression>
 </parameter>
 <parameter name="FirstDayOfMonth" class="java.lang.String" isForPrompting="false">
  <defaultValueExpression><![CDATA[new SimpleDateFormat("EEE").format(java.util.Date.parse(MONTH($P{Date}) + "/1/" + YEAR($P{Date})))]]></defaultValueExpression>
 </parameter>
 <parameter name="DayReturnValueString" class="java.lang.String" isForPrompting="false">
  <parameterDescription><![CDATA[]]></parameterDescription>
  <defaultValueExpression><![CDATA[$P{FirstDayOfMonth}.equals("Sun") ? "0":
$P{FirstDayOfMonth}.equals("Mon") ? "1" :
$P{FirstDayOfMonth}.equals("Tue") ? "2" :
$P{FirstDayOfMonth}.equals("Wed") ? "3" :
$P{FirstDayOfMonth}.equals("Thu") ? "4" :
$P{FirstDayOfMonth}.equals("Fri") ? "5" :
$P{FirstDayOfMonth}.equals("Sat") ? "6" : "100"]]></defaultValueExpression>
 </parameter>
 <parameter name="DayReturnValueInteger" class="java.lang.Integer" isForPrompting="false">
  <parameterDescription><![CDATA[]]></parameterDescription>
  <defaultValueExpression><![CDATA[Integer.parseInt($P{DayReturnValueString})]]></defaultValueExpression>
 </parameter>
 <queryString>
  <![CDATA[select 1 as One]]>
 </queryString>
 <field name="one" class="java.lang.Integer"/>
 <title>
  <band height="180">
   <textField pattern="MMMM d, yyyy">
    <reportElement x="330" y="0" width="190" height="30" uuid="21293131-3839-43aa-b449-b19867eee2da"/>
    <textElement textAlignment="Left" verticalAlignment="Middle">
     <font size="12" isBold="true"/>
    </textElement>
    <textFieldExpression><![CDATA[$P{Date}]]></textFieldExpression>
   </textField>
   <staticText>
    <reportElement mode="Opaque" x="844" y="30" width="210" height="31" forecolor="#000000" backcolor="#FFFFFF" uuid="81be3ac1-c1c1-4573-86a7-67c891288f1c">
     <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
    </reportElement>
    <box>
     <pen lineWidth="1.0" lineColor="#B1B5B4"/>
    </box>
    <textElement textAlignment="Center" verticalAlignment="Middle">
     <font size="14" isBold="true"/>
    </textElement>
    <text><![CDATA[Thursday]]></text>
   </staticText>
   <staticText>
    <reportElement mode="Opaque" x="1055" y="30" width="210" height="31" forecolor="#000000" backcolor="#FFFFFF" uuid="9442d83e-3726-4db9-8746-04b2fea1449b">
     <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
     <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
    </reportElement>
    <box>
     <pen lineWidth="1.0" lineColor="#B1B5B4"/>
    </box>
    <textElement textAlignment="Center" verticalAlignment="Middle">
     <font size="14" isBold="true"/>
    </textElement>
    <text><![CDATA[Friday]]></text>
   </staticText>
   <staticText>
    <reportElement mode="Opaque" x="1266" y="30" width="210" height="31" forecolor="#000000" backcolor="#FFFFFF" uuid="edc883b5-0e35-4e17-8a45-56efc9dacf6a">
     <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
     <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
    </reportElement>
    <box>
     <pen lineWidth="1.0" lineColor="#B1B5B4"/>
    </box>
    <textElement textAlignment="Center" verticalAlignment="Middle">
     <font size="14" isBold="true"/>
    </textElement>
    <text><![CDATA[Saturday]]></text>
   </staticText>
   <textField>
    <reportElement x="330" y="30" width="190" height="30" uuid="ca304690-d49b-4280-8c75-8fd1451bd59f"/>
    <textElement verticalAlignment="Middle">
     <font size="12" isBold="true"/>
    </textElement>
    <textFieldExpression><![CDATA[new SimpleDateFormat("MM/dd/yyyy").format(java.util.Date.parse(MONTH(NOW( )) + "/1/" + YEAR(NOW())))]]></textFieldExpression>
   </textField>
   <textField>
    <reportElement x="330" y="61" width="190" height="30" uuid="5d27b8b2-76cf-4eed-8486-6644f5a2c77c"/>
    <textElement verticalAlignment="Middle">
     <font size="12" isBold="true"/>
    </textElement>
    <textFieldExpression><![CDATA[$P{FirstDateOfMonth}]]></textFieldExpression>
   </textField>
   <textField>
    <reportElement x="330" y="90" width="190" height="30" uuid="66294bd1-0841-4c2a-b33a-928a0cb1aa0a"/>
    <textElement>
     <font size="12" isBold="true"/>
    </textElement>
    <textFieldExpression><![CDATA[$P{FirstDayOfMonth}]]></textFieldExpression>
   </textField>
   <textField>
    <reportElement x="330" y="120" width="190" height="30" uuid="83fa6364-da26-4578-beaf-58932abc6aab"/>
    <textElement>
     <font size="12" isBold="true"/>
    </textElement>
    <textFieldExpression><![CDATA[$P{DayReturnValueString}]]></textFieldExpression>
   </textField>
   <textField>
    <reportElement x="330" y="150" width="190" height="30" uuid="e341926d-38a0-40e7-b4a6-9232352a7247"/>
    <textElement>
     <font size="12" isBold="true"/>
    </textElement>
    <textFieldExpression><![CDATA[$P{DayReturnValueInteger}]]></textFieldExpression>
   </textField>
   <textField>
    <reportElement x="0" y="30" width="330" height="30" uuid="132ad66e-8839-4c41-8e00-9d77cf0ad6b8"/>
    <textElement verticalAlignment="Middle">
     <font size="12" isBold="true"/>
    </textElement>
    <textFieldExpression><![CDATA["First Date Of Month In TEXT field"]]></textFieldExpression>
   </textField>
   <textField>
    <reportElement x="0" y="60" width="330" height="30" uuid="166e5bec-db19-4a56-a335-470008c8094c"/>
    <textElement verticalAlignment="Middle">
     <font size="12" isBold="true"/>
    </textElement>
    <textFieldExpression><![CDATA["First Date Of Month from Parameter Calcualtion"]]></textFieldExpression>
   </textField>
   <textField>
    <reportElement x="0" y="91" width="330" height="30" uuid="dfd0e3d3-1641-4380-984f-0066d8a9112c"/>
    <textElement verticalAlignment="Middle">
     <font size="12" isBold="true"/>
    </textElement>
    <textFieldExpression><![CDATA["Day Name of First Date Of Month"]]></textFieldExpression>
   </textField>
   <textField>
    <reportElement x="0" y="120" width="330" height="30" uuid="d64905e0-2d87-415f-acab-3747492a2071"/>
    <textElement verticalAlignment="Middle">
     <font size="12" isBold="true"/>
    </textElement>
    <textFieldExpression><![CDATA["Retruning 0,1,2... for Sun, Mon, Tue, ...."+"as a String"]]></textFieldExpression>
   </textField>
   <textField>
    <reportElement x="0" y="150" width="330" height="30" uuid="99f5b0f5-cefb-449b-9edb-e444e4afa5d5"/>
    <textElement verticalAlignment="Middle">
     <font size="12" isBold="true"/>
    </textElement>
    <textFieldExpression><![CDATA["Retruning 0,1,2... for Sun, Mon, Tue, ...."+"as an Integer"]]></textFieldExpression>
   </textField>
   <textField>
    <reportElement x="0" y="0" width="330" height="30" uuid="09477045-1a0c-4c25-8776-715036b8c726"/>
    <textElement verticalAlignment="Middle">
     <font size="12" isBold="true"/>
    </textElement>
    <textFieldExpression><![CDATA["Date Entered"]]></textFieldExpression>
   </textField>
  </band>
 </title>
</jasperReport>