<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
   <title>Oracle BI Publisher Blog</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/xmlpublisher/" />
   <link rel="self" type="application/atom+xml" href="http://blogs.oracle.com/xmlpublisher/xml/rss.xml" />
   <id>tag:blogs.oracle.com,2009:/xmlpublisher//63</id>
   <updated>2009-07-01T18:15:41Z</updated>
   <subtitle>a blog for all things blip ...</subtitle>
   <generator uri="http://www.sixapart.com/movabletype/">Movable Type Enterprise 1.52-en-voltron-r47459-20070213</generator>

<entry>
   <title><![CDATA[First Last &amp; Always]]></title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/xmlpublisher/2009/07/first_last_always.html" />
   <id>tag:blogs.oracle.com,2009:/xmlpublisher//63.13152</id>
   
   <published>2009-07-01T17:57:04Z</published>
   <updated>2009-07-01T18:15:41Z</updated>
   
   <summary>Been reminiscing about music from my youth, a boy of the eighties there was so much going on back then. I was into some weird stuff Gene Loves Jezebel, the Boot Hill Foottappers, the list goes on, I was also...</summary>
   <author>
      <name>Tim Dexter</name>
      
   </author>
         <category term="RTF" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="first" label="first()" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="last" label="last()" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/xmlpublisher/">
      <![CDATA[<p>Been reminiscing about music from my youth, a boy of the eighties there was so much going on back then. I was into some weird stuff Gene Loves Jezebel, the Boot Hill Foottappers, the list goes on, I was also into the <a href="http://en.wikipedia.org/wiki/First_and_Last_and_Always">Sisters of Mercy</a> where the title for this post comes from. Im nothing if not consistent with my tenuous blog titles.</p>

<p>Quick question on an internal forum asking how to show just the first and last record in a group. XPATH to the rescue there are a couple of functions we can use to fetch just the first and last record. Lets assume we are looping over EMPLOYEES.</p>

<pre>&lt;?for-each:EMPLOYEES?&gt;</pre>

<p>this will fetch all records. With the addition of the XPATH expression</p>

<pre>&lt;?for-each:EMPLOYEES[position()='1' or position()=last()]?&gt;</pre>

<p>The XPATH standard allows us to create a filter, if or boolean expression to limit the number of rows to be rendered.</p>

<p>position() - returns the current record being process. So position() = 1 will only return the first record</p>

<p>last() - returns the last record pointer. So position()=last() will give us the last record only.</p>

<p>Combining them together with an 'or' statement ensures we only get the first and last record in our group. Done!<br />
</p>]]>
      
   </content>
</entry>
<entry>
   <title>How to keep your “dates” from going wild!</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/xmlpublisher/2009/06/how_to_keep_your_dates_from_go.html" />
   <id>tag:blogs.oracle.com,2009:/xmlpublisher//63.12918</id>
   
   <published>2009-06-18T04:26:47Z</published>
   <updated>2009-06-18T04:55:59Z</updated>
   
   <summary>Have you ever faced a situation where your dates are just gone wild? For example, you could swear that the date in your XML data is 2009-03-01 (March 1st, 2009), but it shows up on your report as 28-FEB-2009! I...</summary>
   <author>
      <name>nikos.psomas</name>
      
   </author>
         <category term="General" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/xmlpublisher/">
      <![CDATA[<p>Have you ever faced a situation where your dates are just  gone wild? For example, you could swear that the date in your XML data is  2009-03-01 (March 1st, 2009), but it shows up on your report as 28-FEB-2009!<br />
</p>
<p>I have seen several emails the last few months come to the help mailing list with date formatting related questions, that I thought this might be a  worthwhile topic for a blog article.</p>
<p>The cause of this, what some call “odd” behavior, is a  combination of four things:</p>
<ol>
  <li>How dates are stored in the XML data</li>
  <li>Whether and how you format dates in the RTF template</li>
  <li>The timezone that you run the report</li>
  <li>And this thing called Coordinated Universal Time known  as UTC<br />
  </li>
</ol>
<p>If you find the acronym UTC confusing, it’s because it’s a <em>backronym</em>, not an <em>acronym</em>! Long story short, blame it on the French (or the  Americans, depending on which side of the Atlantic you are!) You can read all  about it here: <a href="http://en.wikipedia.org/wiki/Coordinated_Universal_Time">http://en.wikipedia.org/wiki/Coordinated_Universal_Time</a>.<br />
<p>So…, here is how  these four things together can ruin your “date”!<br /></p>
<ol>
  <li>At run time, BI Publisher server converts dates that you  have applied a format mask in your RTF template to the timezone that the report  is destined for (the report timezone).</li>
  <li>When you apply a date format mask to a field in your RTF  template, BI Publisher expects the incoming dates from the XML data to be in  canonical format. That is, <span class="style1">YYYY-MM-DDThh:mm:ss<u>+</u>HH:MM</span>,  a standard way to represent date and time in reference to UTC. The <u><span class="style1">+</span></u><span class="style1">HH:MM</span>  is the positive or negative difference of the timezone where the data  originates from UTC/GMT.</li>
  <li>If the time component and UTC offset is omitted (i.e.  the XML date is in the format <span class="style1">YYYY-MM-DD</span>), BI Publisher interprets the date as  <span class="style1">YYYY-MM-DDT00:00:00-00:00</span> (i.e. midnight GMT).</li>
</ol>
<p>If you are responsible for generating the data for the  report, you don’t need to worry about converting your dates to canonical  format. BI publisher will do that automatically for you. </p>
<p>For example, when you issue the query “<span class="style1">Select SYSDATE from DUAL</span>” from BI  Publisher, it generates the following XML data set:</p>
<p class="style1">&lt;ROWSET&gt;<br />
  &lt;ROW&gt;<br />
&lt;SYSDATE&gt;2009-06-03T18:44:32.000-07:00&lt;/SYSDATE&gt;<br />
&lt;/ROW&gt;<br />
&lt;/ROWSET&gt;</p>
<p>  Of course no one likes to see dates on their report in that  format! </p>
<p>Provided, you want dates and time to be converted to the  appropriate time zone the report is destined for, the best and most  straightforward approach to address that is to apply a format mask to the date  field in your RTF template and let BI Publisher take care of the rest.  </p>
<p>For information on how and the types of format masks that  you can apply to a date field refer to <strong>Number  and Date Formatting</strong> in the product documentation: <a href="http://download.oracle.com/docs/cd/E12844_01/doc/bip.1013/e12187/T421739T481157.htm#4535403">http://download.oracle.com/docs/cd/E12844_01/doc/bip.1013/e12187/T421739T481157.htm#4535403</a></p>
<p>You can  also view the <strong>Formatting Dates</strong> demo  available in our Demonstration Library on our OTN page. The URL to out  demonstration library is:<br />
  <a href="http://www.oracle.com/technology/products/xml-publisher/demoshelf/shelf.html">http://www.oracle.com/technology/products/xml-publisher/demoshelf/shelf.html</a></p>
<p>Keeping in mind that if you apply a format mask to a date  field in your RTF template, it will result in the conversion of dates and times  depending on the report timezone, it’s quite normal for a date to roll back or  forward by 1 when your run the report!</p>
<p><u><strong>EXAMPLE 1</strong></u><br />
If you use <span class="style1">&lt;?format-date:SYSDATE;'LONG_TIME'?</span>&gt; in your RTF template, with  the following data set:</p>
<p class="style1">&lt;ROWSET&gt;<br />
  &lt;ROW&gt;<br />
  &lt;SYSDATE&gt;2009-06-03T18:44:32.000-07:00&lt;/SYSDATE&gt;<br />
  &lt;/ROW&gt;<br />
  &lt;/ROWSET&gt;</p>
<p>It will result in these dates displayed on the report:<br />
  ------------------------------------------------------------------------------------------------------------------------<br />
  Report Timezone                                                                             SYSDATE<br />
  ------------------------------------------------------------------------------------------------------------------------<br />
  [GMT – 07:00] – America/Los _Angeles                                  Wednesday,  June 3, 2009 6:44 PM<br />
  [GMT + 08:00] – Asia/Singapore                                              Thursday, June 4, 2009 9:44 AM<br />
------------------------------------------------------------------------------------------------------------------------</p>
<p>Think  about it, in this example, the value of SYSDATE is the time I am writing this blog  article in California, Wednesday 18:44:32 (6:44 PM) PDT on June 3rd.  My friend Babar in Singapore, 15 hrs ahead of me, is having his third cup of  coffee at 9:44 AM, Thursday morning of Jun 4th! Nothing “odd” about that!</p>
<p><u><strong>EXAMPLE 2</strong></u><br />
If instead the XML date in the data is in the format  YYYY-MM-DD, as in the following data set,</p>
<p class="style1">&lt;ROWSET&gt;<br />
  &lt;ROW&gt;<br />
  &lt;SYSDATE&gt;2009-06-03&lt;/SYSDATE&gt;<br />
  &lt;/ROW<br />
  &lt;/ROWSET&gt;</p>
<p>Running the report using the same RTF template as above, it  will result in these dates displayed on the report:<br />
  -----------------------------------------------------------------------------------------------------------------------<br />
  Report Timezone                                                                             SYSDATE<br />
  ------------------------------------------------------------------------------------------------------------------------<br />
  [GMT – 07:00] – America/Los _Angeles                                  Tuesday, June 2, 2009  5:00 PM<br />
  [GMT + 08:00] – Asia/Singapore                                             Wednesday, June 3,  2009 8:00 AM<br />
------------------------------------------------------------------------------------------------------------------------</p>
<p>  The  same reasoning applies here. BI Publisher interprets the value of SYSDATE to  represent Wednesday, June 3, 12 AM GMT. For me, 7 hrs behind during daylight  savings time, it’s still June 2, 5:00 PM. And my friend Babar in Singapore has  just finished his first cup of coffee on June 3rd!<br />
<p>What if you don’t want dates to be converted based on the  report timezone?</p>
<p>One solution to that is to extract dates in the format that  you want them to appear on your report and don’t apply a format mask to date  fields in the RTF template.  Chances are  that BI Publisher will ignore the format mask anyway, unless the format that  you extract the dates in matches the date part of the canonical format that  dates are expected to be in (i.e., <span class="style1">YYYY-MM-DD</span>). </p>
<p>  To extract dates in a specific format, you can use a TO_CHAR  function in the query.  For example, &quot;<span class="style1">Select TO_CHAR(SYSDATE,’DD/MM/YYYY’) as  SYS_DATE from DUAL</span>&quot; will generate the following data set:</p>
<p class="style1">&lt;ROWSET&gt;<br />
  &lt;ROW&gt;<br />
  &lt;SYS_DATE&gt;03/06/2009&lt;/SYS_DATE&gt;<br />
  &lt;/ROW&gt;<br />
  &lt;/ROWSET&gt;</p>
<p>The other option is to extract dates in the format required  by BI Publisher, and specify a timezone in the format mask for the conversion  to override the default, which is the report timezone. If you specify a  timezone with the same UTC offset as the dates in the XML data, no conversion  takes place.<br />
  </p>
<p>For example, <span class="style1">&lt;?format-date:SYSDATE;'LONG';’America/Los_Angeles’?&gt;</span>  with the data in EXAMPLE 1, will always result in <em>Wednesday, June 3, 2009</em> displayed on the  report.</p>
<p>  On the other hand, <span class="style1">&lt;?format-date:SYSDATE;'LONG';’UTC’?&gt;</span>  with the data in EXAMPLE 2, will also result in <em>Wednesday, June 3, 2009</em> displayed on the  report.</p>
<p>  Conclusion – <br />
  If you’d like your “dates” to behave, be nice to them and play  by the rules!</p>]]>
      
   </content>
</entry>
<entry>
   <title>Data Template Progression</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/xmlpublisher/2009/06/data_template_progression.html" />
   <id>tag:blogs.oracle.com,2009:/xmlpublisher//63.12835</id>
   
   <published>2009-06-10T21:53:19Z</published>
   <updated>2009-06-10T22:33:53Z</updated>
   
   <summary>I recently spent some time putting together a progression of data templates (DT) for a customer demo. Its a series of data templates that move you from the simple to the more complex, two query, before fetch trigger, group filter,...</summary>
   <author>
      <name>Tim Dexter</name>
      
   </author>
         <category term="Data Extraction" scheme="http://www.sixapart.com/ns/types#category" />
         <category term="Data Templates" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/xmlpublisher/">
      <![CDATA[<p>I recently spent some time putting together a progression of data templates (DT) for a customer demo. Its a series of data templates that move you from the simple to the more complex, two query, before fetch trigger, group filter, summarizing all singing all dancing data template. I have heard requests this week for a three'er - looking at that. For now, satisfy yourselves with what I have.</p>

<p>Yep, still no builder but the 11g data builder is so cool it makes my geeky mouth water. Can not post images for fear of product management reprisal and bats up night dresses in the small hours (go Google it :0) <br />
In spite of the lack of a DT builder  I found it quite useful and so much faster to start off with the queries, get them working and returning data based on the parameters and to then move to the grouping, group filters (please dont use em) and summary columns. Rather than trying to write the whole this in one hit and then spend forever debugging.</p>

<p>During the demo we discussed the error messages and means to debug that BIP offers. Some of the layout errors are still mystifying at times '1=1' and '9<10' come to mind as true but very annoying error messages. You'll be pleased to here that turning on the debug for the data templates provides a mass of information about what is going on and of course what did not happen and why.</p>

<p>If you're interested you can get the progression <a href="http://blogs.oracle.com/xmlpublisher/files/Data%20Templates.zip">here</a>. Just unpack them under a directory under the BIP reports home directory. Fire up BIP and they will be available. They all run against the demo HR schema in an Oracle db. There is also a sql script for the supporting plsql package for the triggers.<br />
Finally, just because its amusing and I wanted to share the mirth, check out this funny developer '<a href="http://bexhuff.com/2009/06/how-software-engineers-think">joke</a>' from Bex on his blog, made me chortle!</p>]]>
      
   </content>
</entry>
<entry>
   <title>Conditional Headers!</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/xmlpublisher/2009/06/conditional_headers.html" />
   <id>tag:blogs.oracle.com,2009:/xmlpublisher//63.12806</id>
   
   <published>2009-06-08T20:59:59Z</published>
   <updated>2009-06-08T20:53:07Z</updated>
   
   <summary>No nota post about some prima donna football (soccer) player that does not want to muss his hair up nor loose more precious brain cells putting his head to the ball. Far more exciting than that, its more templating fun....</summary>
   <author>
      <name>Tim Dexter</name>
      
   </author>
         <category term="RTF" scheme="http://www.sixapart.com/ns/types#category" />
         <category term="Templates" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/xmlpublisher/">
      <![CDATA[<p>No nota post about some prima donna football (soccer) player that does not want to muss his hair up nor loose more precious brain cells putting his head to the ball. Far more exciting than that, its more templating fun.<br />
I have been exchanging a few mails with Tony this morning. How can one conditionally call a header into a report? is the crux of his question.</p>

<p>The answer, is relatively simple, for a change. You can use a sub template (I have written about those elsewhere in this blog) to store the header (and footer) layouts you want to possibly call.<br />
They take the format<br />
<pre><br />
&lt;?template:Header1?><br />
... header 1 layout table, etc<br />
&lt;?end template Header1?&gt;</p>

<p>&lt;?template:Header2?><br />
... header 2 layout table, etc<br />
&lt;?end template Header2?&gt;</p>

<p>&lt;?template:Footer1?><br />
... footer 1 layout table, etc<br />
&lt;?end template Footer1?&gt;</pre></p>

<p>and so on, just use an RTF template to make life simple on the layout.<br />
You need to make this sub template accessible either via a URL or directory path, from the root directory - no relative path support at the moment.</p>

<p>In the main template you need to register the sub template you want to use with an import statement:</p>

<pre>&lt;?import:http://127.0.0.1:9704/HeaderFooter.rtf?&gt;</pre>

<p>Now you can call the various header and footer templates you have in the sub template. In the Word header you can not use formfields so you have to write the clear text such as:</p>

<pre>&lt;?if:.//DEPARTMENT_NAME=’Accounting’?&gt;
 &lt;?call@inlines:Header?&gt;
  &lt;?with-param:ReportName;string('Accounting Report’)?&gt; 
 &lt;?end call?&gt;
&lt;?end if?&gt;</pre>

<p>you can use a choose: statement too, nested 'if' will not work thou.<br />
I built some samples, get em <a href="http://blogs.oracle.com/xmlpublisher/files/HeaderFooter.zip">here</a>. You'll notice the parameter passing in the template call, think I have covered that elsewhere too.</p>]]>
      
   </content>
</entry>
<entry>
   <title>Building XSL templates</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/xmlpublisher/2009/06/building_xsl_templates.html" />
   <id>tag:blogs.oracle.com,2009:/xmlpublisher//63.12767</id>
   
   <published>2009-06-05T19:51:56Z</published>
   <updated>2009-06-05T20:00:29Z</updated>
   
   <summary>Spent some time over the last few days helping Bryan out on a project for a customer, I say helped but really just pushed him in the right direction, he joined the rather disparate dots and came up with the...</summary>
   <author>
      <name>Tim Dexter</name>
      
   </author>
         <category term="Templates" scheme="http://www.sixapart.com/ns/types#category" />
         <category term="XSL" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="mapping" label="mapping" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="xmltoxml" label="xml to xml" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="xsl" label="xsl" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/xmlpublisher/">
      <![CDATA[<p>Spent some time over the last few days helping Bryan out on a project for a customer, I say helped but really just pushed him in the right direction, he joined the rather disparate dots and came up with the solution. The customer needed regular report outputs ie PDF, RTF, etc but they also needed an XML transformation. We tend to forget sometimes that BIP is very capable of transforming from one XML format to another format. After all, at its heart is an XSLT engine and what do they normally do? Transform XML of course!</p>

<p>So Bryan had the query and the ROWSET/ROW XML but needed to get to the customers format, they possessed an XML schema (XSD) for their format, he just needed the XSL stylesheet, simple right? Not quite so, without either investing in really learning XSL or purchasing an XSL mapper.</p>

<p>I had been looking at the BPEL engine recently and remembered that some of their tutorials had me use an XSL mapper inside JDeveloper. Just needed to fire it up and find it, I have been using 10.1.3.x JDev for my projects and searching through their documentation I found what I needed.</p>

<p align=center><img alt="xslmapper.jpg" src="http://blogs.oracle.com/xmlpublisher/images/xslmapper.jpg" width="600" height="339" /></p>

<p>Its pretty neat and provides just about everything you might need in terms of mapping, it generates an XSL file for you and above all ... it's free!</p>

<p>If you want to try it out, you'll need the source XSD and target XSD and thereby hangs a tail. How to generate the XSD? they are not very nice to hand code and again you often need to invest in a tool to help build it. There are some options, a little known feature of the data engine in BIP is an API that will spit out a schema file based on a data template ... ahhh but you need to build out the data template first ... dang! Another option, Bryan found this little gem, is a free XML to XSD service out on the intertubes - <a href="http://www.flame-ware.com/products/xml-2-xsd/">http://www.flame-ware.com/products/xml-2-xsd/</a>. Give it an XML and it will pass back an XSD. The XSD is only going to be as good as your input XML and you might need to tinker with it but for the purposes of mapping it should be more than sufficient. So, now you are armed with your two XSDs you can get the mapper fired up.</p>

<p>You just need to create an application and project in JDev then add a new XSL Map (New -&gt; Integration Tier -&gt; XML.) </p>

<p align=center><img alt="xslmapper2.jpg" src="http://blogs.oracle.com/xmlpublisher/images/xslmapper2.jpg" width="600" height="429" /></p>

<p>You will then be prompted for the source and target XSDs</p>

<p align=center><img alt="xslmapper3.jpg" src="http://blogs.oracle.com/xmlpublisher/images/xslmapper3.jpg" width="600" height="500" /></p>

<p>Use the Import Schema File ... button to bring your schemas into the project. The mapper UI will then pop up and you can start dragging and dropping source elements/attributes onto the target schema. You can 'run' the conversion at any time to check you are getting the desired result. Once happy, click the 'Source' tab, at the bottom of the mapping window to get to the XSL stylesheet.<br />
Now its just a case of loading the XSL as a new template and setting the type to ensure BIP is expected to generate XML and you are off to the races as they say back in dear ol'Blighty.</p>]]>
      
   </content>
</entry>
<entry>
   <title>Charts with Top 5 + Rest of World</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/xmlpublisher/2009/06/charts_with_top_5_rest_of_worl_1.html" />
   <id>tag:blogs.oracle.com,2009:/xmlpublisher//63.12722</id>
   
   <published>2009-06-04T00:14:05Z</published>
   <updated>2009-06-04T18:02:46Z</updated>
   
   <summary>This is Klaus from the BI Publisher team with a write-up on a recent customer request. I have been asked on how to implement a chart that shows the top 5 customers (district, countries…) in a pie chart and then...</summary>
   <author>
      <name>klaus.fabian</name>
      
   </author>
         <category term="Charting" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/xmlpublisher/">
      <![CDATA[<p>This is Klaus from the BI Publisher team with a write-up on a recent customer request.</p>

<p>I have been asked on how to implement a chart that shows the top 5 customers (district, countries…) in a pie chart and then have a special slice that accumulates all the remaining customers.</p>

<p>I think this is very useful – pie charts with 20 or more slices are hard to read. If you just limit the pie chart to the top 5 customers, then the percentage value shows the percentage of a slice as a percentage of the top 5 and not of the complete data set. </p>

<p>A good approach is to keep the remaining customers in the chart in a summarized form.<br />
I have seen these summarized columns called “Rest of World” in a chart showing countries.</p>

<p>You can download the <a href="http://blogs.oracle.com/xmlpublisher/Chart%20with%20Rest%20of%20World.zip">demo files here</a>. Please make sure that you copy the subtemplate.xsl to C:\test or change the import statement in the first form field to the correct location.</p>

<p>The solution requires XSL coding and the use of a sub template. These techniques are useful solve many complicated reporting problems. Subtemplates are a good technique to keep larger code blocks outside of the word document - we plan to add more support for sub templates in a coming release.</p>

<p>We are working for this example with the Paint Exec sample data that is used in the sample report <em>/Executive/Revenue by Region</em>. The data has the following form.</p>

<p>&lt;ROWSET&gt;<br />
 &lt;ROW&gt;<br />
  &lt;Markets.District&gt;CHICAGO DISTRICT&lt;/Markets.District&gt;<br />
  &lt;Products.Brand&gt;Enterprise&lt;/Products.Brand&gt;<br />
  &lt;Measures.Dollars&gt;1555548.0&lt;/Measures.Dollars&gt;<br />
 &lt;/ROW&gt;<br />
&lt;/ROWSET&gt;</p>

<p>We start with the Pie chart that is generated by the template builder for Word:</p>

<p><img alt="Regular BI Publisher Pie Chart" src="http://blogs.oracle.com/xmlpublisher/Charts%20with%20Top%205%20%2B%20Rest%20of%20World%201.JPG" width="450" height="296" /></p>

<p><strong>Top 5 Chart</strong></p>

<p>Let’s first limit the pie chart to show only 5 slices.</p>

<p>1) First we fix the number of data rows for BI Beans to 5 – instead of the complete data set.</p>

<p>chart:<br />
&lt;Graph depthAngle="50" seriesEffect="SE_AUTO_GRADIENT" graphType="PIE"&gt;<br />
&lt;LegendArea visible="true" /&gt;<br />
&lt;LocalGridData colCount="1"  rowCount="<strong>5</strong>"&gt;</p>

<p>2) We change from ordering the labels by Market District to ordering them by measure.Dollars per district.</p>

<p>&lt;RowLabels&gt;<br />
<strong>&lt;xsl:for-each-group select=".//ROW" group-by="Markets.District"&gt;<br />
&lt;xsl:sort select="sum(current-group()/Measures.Dollars)" data-type="number" order="descending"/&gt;</strong></p>

<p>3) We need to select the first 5 elements – this is not mandatory for now but will necessary for adding the rest of world. Note: XSL requires us to use the escape sequence &amp;lt; for “,”.</p>

<p><strong>&lt;xsl:if test="position()&amp;lt;6"&gt;</strong><br />
&lt;Label&gt;&lt;xsl:value-of select="current-group()/Markets.District" /&gt;&lt;/Label&gt;<br />
<strong>&lt;/xsl:if&gt;</strong><br />
&lt;/xsl:for-each-group&gt;<br />
&lt;/RowLabels&gt;<br />
&lt;DataValues&gt;</p>

<p>4) We sort the data elements by revenue per district.</p>

<p>&lt;xsl:for-each-group select=".//ROW" group-by="Markets.District"&gt;<br />
<strong>&lt;xsl:sort select="sum(current-group()/Measures.Dollars)" data-type="number" order="descending"/&gt;</strong></p>

<p>5) We select only the first 5 elements – this is not mandatory for now but will necessary for the next step</p>

<p><strong>&lt;xsl:if test="position()&amp;lt;6"&gt;</strong><br />
&lt;RowData&gt;<br />
 &lt;Cell&gt;&lt;xsl:value-of select="sum(current-group()/Measures.Dollars)" /&gt;&lt;/Cell&gt;<br />
&lt;/RowData&gt;<br />
<strong>&lt;/xsl:if&gt;</strong><br />
&lt;/xsl:for-each-group&gt;<br />
&lt;/DataValues&gt;</p>

<p>The resulting graph looks less cluttered – but it does not show percentages of the total:</p>

<p><img alt="Chart with top 5" src="http://blogs.oracle.com/xmlpublisher/Charts%20with%20Top%205%20%2B%20Rest%20of%20World%202.JPG" width="448" height="296" /></p>

<p><br />
<strong>Rest of World</strong><br />
Now we need to calculate the remaining values.</p>

<p>6) Any complicated calculation should better be performed in a separate XSL stylesheet. We write a function in XSL called “others” that calculates the total of the remaing members. </p>

<p>&lt;?xml version="1.0" encoding='utf-8'?&gt;<br />
&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="2.0"&gt;<br />
&lt;xsl:output method="xml" encoding="UTF-8"/&gt;</p>

<p>&lt;xsl:template name="others"&gt;<br />
  &lt;xsl:variable name="list"&gt;<br />
   &lt;xsl:for-each-group select="/ROWSET/ROW" group-by="Markets.District"&gt;<br />
    &lt;xsl:sort select="sum(current-group()/Measures.Dollars)" order="descending" data-type="number"/&gt;<br />
      &lt;v&gt;&lt;xsl:value-of select="sum(current-group()/Measures.Dollars)"/&gt;&lt;/v&gt;<br />
   &lt;/xsl:for-each-group&gt;<br />
  &lt;/xsl:variable&gt;<br />
  &lt;xsl:value-of select="sum($list/v[position()&amp;gt;5])"/&gt;<br />
&lt;/xsl:template&gt;<br />
&lt;/xsl:stylesheet&gt;</p>

<p>This template groups all elements by “Market.District” and sort the resulting values by the sum of “Measure.Dollars” per District. The result is stored in the variable v. </p>

<p>Then we sum all elements in the variable with a position greater than 5 with the expression:</p>

<p>  &lt;xsl:value-of select="sum($list/v[position()&amp;gt;5])"/&gt;</p>

<p>The escape sequence “&amp;gt;” means greater then or “&gt;”. We save this XSL-stylesheet with charater set UTF-8  - using for example notepad – to the location:</p>

<p>C:/test/subtemplate.xsl</p>

<p><br />
7) We need import this sub template from the RTF template. For testing we access the file from the file system – for the production implementation to store in on a web server and access it from there.</p>

<p>We add the following statement to the beginning of the document (not the chart!) to import the sub template:<br />
&lt;xsl:import href="file:///C:/test/subtemplate.xsl"/&gt;</p>

<p><br />
8) We increase the row Count from 5 to 6 – replacing step 1-  for the additional “all others” slice.</p>

<p>&lt;LocalGridData colCount="1" rowCount="<strong>6</strong>"&gt;</p>

<p>(9) We need to add a label for the summary of the remaining district</p>

<p>&lt;RowLabels&gt;<br />
&lt;xsl:for-each-group select=".//ROW" group-by="Markets.District"&gt;<br />
&lt;xsl:sort select="sum(current-group()/Measures.Dollars)" data-type="number" order="descending"/&gt;<br />
&lt;xsl:if test="position()&amp;lt;6"&gt;<br />
&lt;Label&gt;&lt;xsl:value-of select="current-group()/Markets.District" /&gt;&lt;/Label&gt;<br />
&lt;/xsl:if&gt;<br />
&lt;/xsl:for-each-group&gt;<br />
<strong>&lt;Label&gt;ALL OTHER'S&lt;/Label&gt;<br />
</strong>&lt;/RowLabels&gt;</p>

<p>(10) Finally we need to add another data row with the sum of all other districts by calling the function “others” defined in (6).</p>

<p><strong>&lt;RowData&gt;&lt;Cell&gt;&lt;xsl:call-template name="others"/&gt;&lt;/Cell&gt;&lt;/RowData&gt;</strong><br />
&lt;/DataValues&gt;<br />
&lt;/LocalGridData&gt;</p>

<p>When we run the chart we see the chart with a new entry and the correct percentages:</p>

<p><img alt="Chart with top 5 and Rest of World" src="http://blogs.oracle.com/xmlpublisher/Charts%20with%20Top%205%20%2B%20Rest%20of%20World%203.JPG" width="448" height="296" /></p>

<p>Below is the final code for the chart above.</p>

<p>chart:<br />
&lt;Graph depthAngle="50" depthRadius="8" pieDepth="30" pieTilt="20" seriesEffect="SE_AUTO_GRADIENT"  graphType="PIE"&gt;<br />
&lt;LegendArea visible="true" /&gt;<br />
&lt;LocalGridData colCount="1" rowCount="6"&gt;<br />
&lt;RowLabels&gt;<br />
&lt;xsl:for-each-group select=".//ROW" group-by="Markets.District"&gt;<br />
&lt;xsl:sort select="sum(current-group()/Measures.Dollars)" <br />
                  data-type="number" order="descending"/&gt;<br />
&lt;xsl:if test="position()&amp;lt;6"&gt;<br />
&lt;Label&gt;&lt;xsl:value-of select="current-group()/Markets.District"/&gt;&lt;/Label&gt;<br />
&lt;/xsl:if&gt;<br />
&lt;/xsl:for-each-group&gt;<br />
&lt;Label&gt;ALL OTHER'S&lt;/Label&gt;<br />
&lt;/RowLabels&gt;<br />
&lt;DataValues&gt;<br />
&lt;xsl:for-each-group select=".//ROW" group-by="Markets.District"&gt;<br />
&lt;xsl:sort select="sum(current-group()/Measures.Dollars)" <br />
          data-type="number" order="descending"/&gt;<br />
&lt;xsl:if test="position()&amp;lt;6"&gt;<br />
&lt;RowData&gt;<br />
&lt;Cell&gt;&lt;xsl:value-of select="sum(current-group()/Measures.Dollars)"/&gt;&lt;/Cell&gt;<br />
&lt;/RowData&gt;<br />
&lt;/xsl:if&gt;<br />
&lt;/xsl:for-each-group&gt;<br />
&lt;RowData&gt;&lt;Cell&gt;&lt;xsl:call-template name="others"/&gt;&lt;/Cell&gt;&lt;/RowData&gt;<br />
&lt;/DataValues&gt;&lt;/LocalGridData&gt;&lt;/Graph&gt;</p>

<p>I hope this is helpful,</p>

<p>Klaus Fabian<br />
<em>Senior Development Manager, BI Publisher;<br />
</em><br />
</p>]]>
      
   </content>
</entry>
<entry>
   <title>Crystal Fallout</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/xmlpublisher/2009/05/crystal_fallout_1.html" />
   <id>tag:blogs.oracle.com,2009:/xmlpublisher//63.12426</id>
   
   <published>2009-05-22T18:07:36Z</published>
   <updated>2009-05-22T18:14:32Z</updated>
   
   <summary>Yesterday I spent most of an entry talking about weather and a little about actual work. Today, no weather, well may a little - its danged raining here in Colorado, again! Great Memorial Day weekend, it&apos;s like living back on...</summary>
   <author>
      <name>Tim Dexter</name>
      
   </author>
         <category term="BI Publisher Enterprise" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="crystal" label="crystal" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="weather" label="weather" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/xmlpublisher/">
      <![CDATA[<p><a href="http://blogs.oracle.com/xmlpublisher/2009/05/tornadic_crystal_migration_1.html">Yesterday</a> I spent most of an entry talking about weather and a little about actual work. Today, no weather, well may a little - its danged raining here in Colorado, again! Great Memorial Day weekend, it's like living back on ol'Blighty. Hey there's a public holiday coming up, don't bother to check the forecast, it will be raining!</p>

<p>Back to the Crystal conversion, the issue we had in the layout template is not a consequence of the Crystal report itself but more of the data structure underneath it. The Oklahoma folks have a system to collect information about traffic incidents and claims, they use Oracle Forms to collect that info, the form has been 'bent' a little to allow their users to collect all the information in a single place. The form is not master detail per se ie section for the claim info and a child section for the drive, owner and responsible party, typically the insurance company. Its all stored at the same level so they have multiple lines with a line for each with a flag for the owner, driver and responsible party. Thats fine but the data set returned by the BIP (and Crystal) query results in a denormalized data set so they have something like.</p>

<p><font face="Courier New">&lt;rowset&gt;<br />
&lt;row&gt;<br />
 &lt;claim_id&gt;1234567&lt;/claim_id&gt;<br />
 &lt;name&gt;Jo Bloggs&lt;/name&gt;<br />
 &lt;address&gt; blah blah blah&lt;/address&gt;<br />
 &lt;driver_flag&gt;Y&lt;/driver_flag&gt;<br />
 ...</p>

<p>&lt;row&gt;<br />
 &lt;claim_id&gt;1234567&lt;/claim_id&gt;<br />
 &lt;name&gt;Big Insurance Co&lt;/name&gt;<br />
 &lt;/row&gt;&lt;/address&gt;&lt;address&gt; blah blah blah&lt;/address&gt;<br />
 &lt;responsible_party&gt;Y&lt;/responsible_party&gt;</font><br />
 ...</p>

<p> and so on, potentially as many as four records for each claim. The issue comes when we need to show this information on the form. There are no 'sections' for each party, its all shown on an easy to read form. So we need to be able to distinguish between the driver and responsible party records under a given CLAIM_ID.</p>

<p>Those with some experience will have jumped on a grouping, . This gives you the means of discerning between claims (there maybe multiple claims in a batch) but we then get into a 'tricksy hobbitises' situation with the rest of the data. We need to show the driver and responsible party data mixed in the form, but as you can see above we have 'NAME' and 'ADDRESS' repeated as elements, if we had had nice prefixes to the elements life would have been easier. But life's not easy :0)</p>

<p>So, after a little head scratching I came up with a way to distinguish between the two data sets - variables. Now in XSL variables are not like regular variables, they are not updatable, more like a constant in that respect. But they do have a great quality we can use, they can contain not only a single value but a complete part of the XML tree. I can load chunks of data into them to create the separate records I need ie a driver variable tree and a responsible party variable tree. I can then reference the values in those variables just by prefixing the variable name so that $driver.NAME and $resp_party.NAME are now different values. Very cunning!</p>

<p>At the top of my template I have </p>

<p> <font face="Courier New">&lt;?for-each-group:ROW;./C_CLAIM_NO?&gt;</font> - just a group by claim number<br />
  <font face="Courier New">&lt;?for-each:current-group()?&gt;</font> - loop thru the rest of the data<br />
   <font face="Courier New">&lt;?variable@context:driver;* [DRIVER='Y']?&gt;</font> - load the record for the driver<br />
   <font face="Courier New">&lt;?variable@context:resp_party;*[RESPONSIBLE_PARTY=’Y’]?&gt;</font> - load the record for the responsible party<font face="Courier New"><br />
&lt;?end for-each?&gt;<br />
...<br />
...<br />
&lt;?$driver/NAME?&gt; <font face="sans-serif">- reference drivers name</font><br />
&lt;?$resp_party/NAME?&gt;<font face="sans-serif"> - reference responsible party name</font><br />
&lt;?end for-each-group?&gt;</font> </p>

<p>To explain the variable declaration, the '*' is saying assign everything in the current record but only if DRIVER = Y ie the first record in the loop. The second variable is doing the same but only where RESPONSIBLE_PARTY = 'Y'. Now I can reference anything I like anywhere in the document by using the $variable_name/ prefix.</p>

<p>Its some hoop jumping to get it right and to be honest I would recommend using a data template to get the data into a nice friendly structure negating the need for the variables. But the exercise was to just migrate the report from Crystal, Crystal was not grouping the data it had to use the sneaky 'whileprocessingrecords' trick. If they have tricks then BIP is entitled to some too. If you're interested I have the template and final output available <a href="http://blogs.oracle.com/xmlpublisher/files/CoolVars.zip">here</a>.</p>]]>
      
   </content>
</entry>
<entry>
   <title>Tornadic Crystal Migration</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/xmlpublisher/2009/05/tornadic_crystal_migration_1.html" />
   <id>tag:blogs.oracle.com,2009:/xmlpublisher//63.12410</id>
   
   <published>2009-05-21T17:48:10Z</published>
   <updated>2009-05-21T17:59:17Z</updated>
   
   <summary>Spent a great couple of days in Oklahoma City last week with the good folks of the Oklahoma Department of transport. When I was asked to go over there a few months back, I agreed on the condition that I...</summary>
   <author>
      <name>Tim Dexter</name>
      
   </author>
         <category term="Migration" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/xmlpublisher/">
      <![CDATA[<p>Spent a great couple of days in Oklahoma City last week with the good folks of the Oklahoma Department of transport. When I was asked to go over there a few months back, I agreed on the condition that I got to see a tornado. I came sooo close its not even funny. <br />
I arrived to weather forecasts of huge storms rolling over the city that night, being a weather geek there was just a little excitement brewing. There had been a tornado out in countryside NW of the city earlier on in the day. There were some great cloud formations (apologies, the iPhone camera does not do it justice)</p>

<p align=center><img alt="OKL_Weather2.jpg" src="http://blogs.oracle.com/xmlpublisher/images/OKL_Weather2.jpg" width="453" height="604" /></p>

<p>Had some dinner and then decided to take a walk in the sweltering 80 degree heat at about 10pm. Got downstairs just in time to catch one of the best lightening storms I have ever seen, not much hitting the ground but at times it was like daylight with about 5 strikes per second (according to the excited weather dude on the TV) Then came the rain, boy did it rain, after about 10mins there was a river rushing down the road ... all very exciting. Then the tornado sirens started, looked about, everyone else was still watching the storm ... fair enough, no one else is bothered I'll stay out. Rather stupidly, I then rang my wife to tell her about the storm and the sirens and how cool it all was. 'Get back inside, stay away from the windows and get in the bath' was her pleading recommendation. Hmmmm ... not sure about the bath, Im sure the hotel would have us down in the basement if they were that worried, watched as the storm moved over us and then back to the room for some serious weather channel watching. Im convinced Im going to end up in a home when Im older, sitting in front of the weather channel and shouting incoherently at the talking heads. The local channels were more enjoyable anyway, with the weather dudes searching for 'hooks' and 'rotations' on the leading edge of the storm. they all had storm chasers out in the dark around town reporting that they might have just seen a 'wall cloud' and the 'base appeared to be lowering but it was dark so they were not quite sure' All good stuff for a weather geek, took a snap of the TV for posterity, I was under some of that purple you can see.</p>

<p align=center><img alt="OKL_Weather.jpg" src="http://blogs.oracle.com/xmlpublisher/images/OKL_Weather.jpg" width="453" height="604" /></p>

<p>Thankfully no touch downs in built up areas, a few roofs blown off but no serious damage and no one injured. It was a good night!</p>

<p>Why was I in Oklahoma? To give the DOT folks some experience of BIP, nothing hands on but we dug into the tool and walked around the standalone server. The DOT folks are big Crystal users so we decided to have a go at taking one of their reports and migrating it. There is a pretty nice paper on this on the BIP web site.<br />
Its a completely manual process but we worked through the paper and I added some tweaks here and there to hopefully seed things up a bit and we found some gotchas along the way that I wanted to share.</p>

<p>The report we took a look at seemed pretty innocuous on first sight, I was surprised, I thought they would give me a tough one. I should have been more wary of Corbi's wry smile as she opened the report :0)</p>

<p>There was only a single query in the report which we copied and pasted into a BIP report, created LOVs and parameters. So far so good, the report ran and generated data. We eventually noticed a problem, here's a gotcha for ya. We were getting a repeating element in the output. i.e. NAME. The problem was that in the Crystal Report the query was selecting </p>

<p>TABLE1.NAME<br />
TABLE2.NAME</p>

<p>Crystal discerns between the two as it keeps the table name associated with the column. Once BIP renders the data it ignores the table name so we get repeated element names. Not a huge problem, but when you load the data into the Template Builder it only shows the first instance on the element. An easy but somewhat annoying work around would be to provide aliases to the columns to make the element names distinct. We made a change to two columns and moved on.</p>

<p>Next the layout, the paper talks about building the layout, I wanted a to take some advantage of the Crystal layout. We needed an RTF output or at least a .doc format that we could re-save as RTF. Crystal offers an export functionality, there are two RTF options, be sure to use the 'editable' RTF option. Once it generates you will get the layout for the layout, its then a case of replacing data with fields using the template builder and you're off to the races.</p>

<p>Here's where things got a little tough, the Crystal report was using a subtle command 'while reading records' to get past a small problem in the schema ... how I got around that, I'll save for tomorrow.</p>]]>
      
   </content>
</entry>
<entry>
   <title>BIP by Extension</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/xmlpublisher/2009/05/bip_by_extension.html" />
   <id>tag:blogs.oracle.com,2009:/xmlpublisher//63.12229</id>
   
   <published>2009-05-13T18:55:35Z</published>
   <updated>2009-05-13T18:55:57Z</updated>
   
   <summary>BIP Extensions? Regular readers may remember I wrote about building BIP extensions a while back. Its a means of adding functionality to your templates by making an external call to a java class. Its very very powerful and completely unsupported...</summary>
   <author>
      <name>Tim Dexter</name>
      
   </author>
         <category term="RTF" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/xmlpublisher/">
      <![CDATA[<p>BIP Extensions? Regular readers may remember I wrote about building <a target="_blank" href="http://blogs.oracle.com/xmlpublisher/2007/09/26/">BIP extensions</a> a while back. Its a means of adding functionality to your templates by making an external call to a java class. Its very very powerful and completely unsupported right now, as I warned before - do not log an SR if you get into trouble.<br />When I last wrote about them I got a few comments and <a target="_blank" href="http://blogs.oracle.com/xmlpublisher/2007/12/its_a_bouncing_baby_extension.html">Frank Menne</a> from <a href="http://www.hsm.de/englisch.html">HSM</a> in Germany went ahead and built one. Im only bringing them up again because I had cause to use one in a recent POC. In my orignal post I showed how you could pass a value thru to the extension for it to return some processed text. This POC required some more sophisticated processing. Take the following data:<br /><pre>&lt;RECORD&gt;<br />
 &lt;CNT&gt;1&lt;/CNT&gt;<br />
 &lt;TYPE&gt;In Bulk&lt;/TYPE&gt;<br />
&lt;/RECORD&gt;<br />
&lt;RECORD&gt;<br />
 &lt;CNT&gt;2&lt;/CNT&gt;<br />
 &lt;TYPE&gt;In Bulk&lt;/TYPE&gt;<br />
&lt;/RECORD&gt;<br />
&lt;RECORD&gt;<br />
 &lt;CNT&gt;3&lt;/CNT&gt;<br />
 &lt;TYPE&gt;In Bulk&lt;/TYPE&gt;<br />
&lt;/RECORD&gt;<br />
&lt;RECORD&gt;<br />
 &lt;CNT&gt;4&lt;/CNT&gt;<br />
 &lt;TYPE&gt;Individual&lt;/TYPE&gt;<br />
&lt;/RECORD&gt;<br />
&lt;RECORD&gt;<br />
 &lt;CNT&gt;5&lt;/CNT&gt;<br />
 &lt;TYPE&gt;In Bulk&lt;/TYPE&gt;<br />
&lt;/RECORD&gt;<br />
&lt;RECORD&gt;<br />
 &lt;CNT&gt;6&lt;/CNT&gt;<br />
 &lt;TYPE&gt;Individual&lt;/TYPE&gt;<br />
&lt;/RECORD&gt;<br />
</pre>This needs to be summarized into <br /><br />1-3,5 In Bulk<br />4,6 Individual<br /><br />Possible using XSL but, it gets very complex very quickly. So I thought if I could push the data to an extension, process it in java with some loops and objects and push the text back Id save myself a whole bunch of XSL templating. But I needed to pass a complete XML tree fragment, not just a single value. Its turns out that that is not very tough. I had registered my extention as 'cert:' so my call to the extension from the RTF template was as follows:<br /><br />&lt;?cert:NumDesc(.//COMMODITY,'PACKAGE_DESCRIPTION')?&gt;<br /><br />NumDesc is my function in the java class<br />.//COMMODITY - passes everything under COMMODITY in the XML tree<br />'PACKAGE_DESCRIPTION - was the element I wanted summarized. I wrote a function to summarize any data this way, just need to pass the element name you are interested in summarizing.<br /><br />The java class was as follows:<br /><pre><br />public class certExtension {<br />&nbsp;&nbsp;&nbsp; public certExtension() {<br />&nbsp;&nbsp;&nbsp; }<br /><br />&nbsp;&nbsp;&nbsp; public static final String NumDesc(NodeList nodes, String eleName)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; String retStr ="";&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NodeList nl;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Element pkg;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Element element;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String outp = "";<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; nodes.getLength(); i++) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; element = (Element) nodes.item(i);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nl = element.getElementsByTagName(eleName);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pkg = (Element) nl.item(0);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Node pd = pkg.getFirstChild();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CharacterData cd = (CharacterData) pd;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return(retStr);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /></pre><br />Sorry, but Im not able to share all of the secret sauce or template right now. The loop you can see is passing over the nodeset passed from the template looking for the specified element name (eleName)<br /><br />I think its a neat solution and worked really well and saved a bunch of time. Do you need to be a java whiz? Not on your nelly, as former BIP colleagues will attest, my java skills are not the hottest on the block. But I get by and spend time Googling and scouring web pages for help :0) <br />There is a caveat, its a little tough to debug. The template is passing the tree fragment at runtime, if things fail, error messages do bubble up to the template builder but they might be a little cryptic. <br />If you have a certain function that you need across templates or even within a template, give it a try.</p>]]>
      
   </content>
</entry>
<entry>
   <title>Oracle Reports Conversion Followup</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/xmlpublisher/2009/05/oracle_reports_conversion_foll.html" />
   <id>tag:blogs.oracle.com,2009:/xmlpublisher//63.12197</id>
   
   <published>2009-05-12T20:26:36Z</published>
   <updated>2009-05-12T21:44:41Z</updated>
   
   <summary>I wrote about a gotcha in the Oracle Reports to BIP conversion libraries last week. Not long after that, &apos;friend of BIP&apos;, IceMan aka Ike Wiggins, self confessed &apos;lazy man&apos;, read the article to realize this is not a bad...</summary>
   <author>
      <name>Tim Dexter</name>
      
   </author>
         <category term="BI Publisher Enterprise" scheme="http://www.sixapart.com/ns/types#category" />
         <category term="E Business Suite" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="migration" label="migration" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/xmlpublisher/">
      <![CDATA[<p>I wrote about a gotcha in the <a href="http://blogs.oracle.com/xmlpublisher/2009/04/oracle_reports_migration_gotch.html">Oracle Reports to BIP</a> conversion libraries last week. Not long after that, 'friend of BIP', <a href="http://blogs.oracle.com/xmlpublisher/2008/11/the_iceman_cometh.html">IceMan</a> aka Ike Wiggins, self confessed 'lazy man', read the article to realize this is not a bad trait :0) dropped me a not<br />
e to say that he had developed a tool to aid in the process of converting a batch of Oracle Reports.</p>

<p>So, if you are starting to convert your 600 Oracle Reports and find the whole thing a little daunting. Never fear, IceMan is here. Get on over to <a href="http://bipublisher.blogspot.com/2009/05/bi-publisher-reports6i-to-bip.html">Ike's blog entry</a>, check out his dulcet tones on the video he recorded and then down load the converter client and you'll be 'off to the races' in no time.</p>

<p>While you are there, check out the <a href="http://bipublisher.blogspot.com/2008/03/bi-publisher-bipublisheride.html">BI Publisher IDE</a> that Ike has developed. If you are working with the BIP APIs or want a one click, load test and generate tool for BIP, Ike has just what you need.</p>]]>
      
   </content>
</entry>
<entry>
   <title>Summary Total Text in BIEE</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/xmlpublisher/2009/05/summary_total_text_in_biee_1.html" />
   <id>tag:blogs.oracle.com,2009:/xmlpublisher//63.9688</id>
   
   <published>2009-05-08T19:12:12Z</published>
   <updated>2009-05-08T18:16:25Z</updated>
   
   <summary>Don&apos;t panic, we&apos;re not turning into a BIEE blog, I have been doing dome work with it lately and could not find the following nugget out there. Colleagues on an internal list helped out with my request - it was...</summary>
   <author>
      <name>Tim Dexter</name>
      
   </author>
         <category term="BIEE" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="biee" label="BIEE" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="totals" label="totals" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/xmlpublisher/">
      <![CDATA[<p>Don't panic, we're not turning into a BIEE blog, I have been doing dome work with it lately and could not find the following nugget out there. Colleagues on an internal list helped out with my request - it was a simple one but I wanted to record it for posterity.</p>

<p>As many of you have seen you can generate totals and sub-totals in your BIP templates quite easily, you can also embed fields into the total label text.</p>

<p align=center><img alt="bieetot1.gif" src="http://blogs.oracle.com/xmlpublisher/images/bieetot1.gif" width="430" height="98" /></p>

<p>To get the customers name in the total text, its just a case of copy and pasting the customer name field into the table cell.</p>

<p align=center><img alt="bieetot2.gif" src="http://blogs.oracle.com/xmlpublisher/images/bieetot2.gif" width="612" height="110" /></p>

<p>I needed to do the same in a BIEE pivot table. Not quite so obvious but doable, once I got some help from my friends, ooooh I get by with a little help from my friends ... danged Guitar Hero! I dont even like the Beatles, for a Brit, sacrilege I know.</p>

<p>Building out the pivot you can see that if you set a total for the group you get XXXXX Total. </p>

<p align=center><img alt="bieetot3.gif" src="http://blogs.oracle.com/xmlpublisher/images/bieetot3.gif" width="611" height="145" /></p>

<p>the dialog to customize the total string is tucked away a little. Click the total icon again and select Format Labels</p>

<p align=center><img alt="bieetot4.gif" src="http://blogs.oracle.com/xmlpublisher/images/bieetot4.gif" width="306" height="219" /></p>

<p>This will pop the dialog</p>

<p align=center><img alt="bieetot5.gif" src="http://blogs.oracle.com/xmlpublisher/images/bieetot5.gif" width="390" height="394" />
</p>

<p>You can now enter the text you want, the '@' character will be replaced at runtime with the actual group value.</p>

<p>The pivot now renders with the required text.</p>

<p align=center><img alt="bieetot6.gif" src="http://blogs.oracle.com/xmlpublisher/images/bieetot6.gif" width="589" height="144" />
</p> ]]>
      
   </content>
</entry>
<entry>
   <title>User Creds on a URL</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/xmlpublisher/2009/05/user_creds_on_a_url.html" />
   <id>tag:blogs.oracle.com,2009:/xmlpublisher//63.11991</id>
   
   <published>2009-05-05T13:45:21Z</published>
   <updated>2009-05-05T14:05:16Z</updated>
   
   <summary>A long while back I posted an entry on linking to a report via a URL. All was good but it only worked if you either: 1. Were hooking BIP up to SSO with your calling application or 2. You...</summary>
   <author>
      <name>Tim Dexter</name>
      
   </author>
         <category term="BI Publisher Enterprise" scheme="http://www.sixapart.com/ns/types#category" />
         <category term="Security" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="url" label="URL" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="password" label="password" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="report" label="report" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="username" label="username" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/xmlpublisher/">
      <![CDATA[<p>A long while back I posted an entry on <a href="http://blogs.oracle.com/xmlpublisher/2007/08/please_link_to_this_report.html">linking to a report via a URL</a>. All was good but it only worked if you either:</p>

<p>1. Were hooking BIP up to SSO with your calling application or<br />
2. You placed the report in the Guest folder which was unsecured.</p>

<p>Now, back in an earlier release the dev guys sneaked a feature out that I was vaguely aware of and thought I knew but it took the almighty Bryan Wise to remind me. You can now pass the username and password on the URL to avoid the two cases above and open up other possibilities.</p>

<p>You can just add the following parameters to your URL</p>

<p>                         &id=XXXXXX&passwd=YYYYYY</p>

<p>For example:</p>

<p>http://127.0.0.1:9704/xmlpserver/HR Manager/W2/W2.xdo?id=Administrator&passwd=Administrator</p>

<p>What about security? Well 'developer beware'!, I wanted some cool Latin phrase that no one would understand but the translators are a little funky in my opinion. Never the less, its a feature, its up to you if you want to use it, or maybe your security folks. So, now you know and I now have somewhere to point folks who ask me about it :)</p>]]>
      
   </content>
</entry>
<entry>
   <title>Oracle Reports Migration Gotcha!</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/xmlpublisher/2009/04/oracle_reports_migration_gotch.html" />
   <id>tag:blogs.oracle.com,2009:/xmlpublisher//63.11847</id>
   
   <published>2009-05-01T00:07:07Z</published>
   <updated>2009-04-30T23:58:17Z</updated>
   
   <summary>In recent weeks I have been working with several customers on the migration utility. As those that have used will know, its not perfect by any means. But it does get you down the path of migration a fair way....</summary>
   <author>
      <name>Tim Dexter</name>
      
   </author>
         <category term="BI Publisher Enterprise" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="oraclereports" label="Oracle Reports" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="migration" label="migration" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/xmlpublisher/">
      <![CDATA[<p>In recent weeks I have been working with several customers on the migration utility. As those that have used will know, its not perfect by any means. But it does get you down the path of migration a fair way.</p>

<p>I spent half an hour scratch my hairless head (Ive run out of hair to pull out so resort to scratching now :) this morning. It was over a variable population error, the value was too large for the variable e.g. squeezing 'Larkspur' into a varchar(2) will not go! What was meant to happen was a code e.g. LK was supposed to go into the variable.</p>

<p>As  you may know, BIP supports LOVs for parameters, you have the option of showing a user value but passing a code to the query. It seems that Oracle Reports works things the other way round i.e. pass the first and show the second ... grrrrr!</p>

<p align=center><img alt="OR_LOV.JPG" src="http://blogs.oracle.com/xmlpublisher/images/OR_LOV.JPG" width="527" height="248" /></p>

<p>A quick look see at Oracle Reports reveals that yep, they use code, user_value whereas BIP uses user_vale, code ... dang!<br />
A look at the XML rendition of the LOV shows that we might be able to get the converter to be a little more intelligent.<br />
<pre><br />
&lt;istOfValues restrictToList="yes"&gt;<br />
 &lt;selectStatement hideFirstColumn="no"&gt;<br />
  &lt;![CDATA[select last_name, employee_id from employees]]&gt;<br />
 &lt;/selectStatement&gt;<br />
&lt;/listOfValues&gt;<br />
</pre></p>

<p>If nothing else, if there are two columns being retrieved then in the converter we need to swap them.</p>

<p>For now, its a manual job to switch them. You now know that rather then become bald, like me, check those LOV values and swap em if necessary ... now where is that bottle of Rogaine?</p>]]>
      
   </content>
</entry>
<entry>
   <title>Template Builder Woes!</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/xmlpublisher/2009/04/template_builder_woes_1.html" />
   <id>tag:blogs.oracle.com,2009:/xmlpublisher//63.11849</id>
   
   <published>2009-04-30T14:07:07Z</published>
   <updated>2009-05-01T16:41:00Z</updated>
   
   <summary>If you have been suffering with Template Builder not installing correctly, or like me, you have installed and uninstalled so many different versions you might want to clean house. Once you have cleaned up things should go more smoothly. Thanks...</summary>
   <author>
      <name>Tim Dexter</name>
      
   </author>
         <category term="RTF" scheme="http://www.sixapart.com/ns/types#category" />
         <category term="Tools" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/xmlpublisher/">
      <![CDATA[<p>If you have been suffering with Template Builder not installing correctly, or like me, you have installed and uninstalled so many different versions you might want to clean house. Once you have cleaned up things should go more smoothly.</p>

<p>Thanks to Junichi, who is the Template Builder lead developer, for these clean up steps.</p>

<p>1. Uninstall BIP desktop from control->Add or remove programs.<br />
2. Open explorer and go to "C:\WINDOWS\assembly".<br />
3. Check if there are assemblies which start with "TB" If present, remove them all.<br />
4. Open the MS Word startup directory and check there are no files there.  The directory is normally the following.</p>

<p>   C:\Documents and Settings\&lt;user name>&lt;Application Data\Microsoft\Word\STARTUP</p>

<p>5. Open MS Word and check that you don't see the BIP tool bar.<br />
   -> If you see it, please move Normal.dot to another directory and try again.</p>

<p>6. Please check that the OS user you use has an administrator privilege on the PC, this is really important.<br />
7. Please go to Control Panel -> Add or Remove programs and check if the followings have been installed.<br />
 Shared Add-in Extensibility Update for Microsoft .NET Framework 2.0 (KB908002)<br />
 Shared Add-in Support Update for Microsoft .NET Framework 2.0 (KB908002) </p>

<p>8. Install BIP Desktop again</p>

<p>Step 5 did it for me!</p>

<p>After following the 8 step plan, Im now clean and sober, sorry that's the other plan Im following. Should have said, your PC/laptop will be clean and fresh with a new working BIP install.</p>]]>
      
   </content>
</entry>
<entry>
   <title>Publisher at Collaborate</title>
   <link rel="alternate" type="text/html" href="http://blogs.oracle.com/xmlpublisher/2009/04/publisher_at_collaborate_1.html" />
   <id>tag:blogs.oracle.com,2009:/xmlpublisher//63.11880</id>
   
   <published>2009-04-29T17:23:52Z</published>
   <updated>2009-05-01T19:46:50Z</updated>
   
   <summary>Heading off to Collaborate next week. Very glad to see that OAUG, Quest and IOUG have created a joint scheduling tool. I can now search across all three tracks and see that there are over 50 sessions that include Publisher...</summary>
   <author>
      <name>mike.donohue</name>
      
   </author>
         <category term="Applications" scheme="http://www.sixapart.com/ns/types#category" />
         <category term="BI Publisher Enterprise" scheme="http://www.sixapart.com/ns/types#category" />
         <category term="E Business Suite" scheme="http://www.sixapart.com/ns/types#category" />
         <category term="General" scheme="http://www.sixapart.com/ns/types#category" />
         <category term="JD Edwards" scheme="http://www.sixapart.com/ns/types#category" />
         <category term="PeopleSoft" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="bipublisher" label="BI Publisher" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="collaborate" label="Collaborate" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="ebusinesssuite" label="E-Business Suite" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="jdedwards" label="JD Edwards" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="peoplesoft" label="PeopleSoft" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="publisher" label="Publisher" scheme="http://www.sixapart.com/ns/types#tag" />
   <category term="xmlpublisher" label="XML Publisher" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://blogs.oracle.com/xmlpublisher/">
      <![CDATA[<p>Heading off to Collaborate next week.  Very glad to see that OAUG, Quest and IOUG have created a <a href="https://secure1.aetherquest.com/Collaborate/2009/index.php?c=1">joint scheduling tool</a>.  </p>

<p>I can now search across all three tracks and see that there are over 50 sessions that include Publisher in some way or form.  A nice range of intro to advanced topics covering the various deployments of Publisher in EBS, JDE and stand alone.  I plan to attend as many as my schedule will allow.</p>

<p>Here are a few being delivered by Oracle folks -- oddly all on Wednesday May 6.  That must be our designated day.</p>

<table cellspacing="4">
<col width="60"></col>
<tr>
<th align="left">Time</th>
<th align="left">Room</th>
<th align="center">Title</th>
<th align="left">Speaker</th>
</tr>
<tr>
<td>9:45am - 10:45am</td>
<td>314B</td>
<td>62280 - BI Publisher - A Tool to Format and Deliver JD Edwards World data</td>
<td>Sharon Winter</td>
</tr>
<tr>
<td>1:30pm - 2:30pm</td>
<td>315A</td>
<td>61530 - Using Oracle's BI Publisher for your JD Edwards EnterpriseOne Reporting</td>
<td>Jeff Erickson</td>
</tr>
<tr>
<td>1:30pm - 2:30pm</td>
<td>W222B</td>
<td>744 - Business Intelligence Publisher Overview and Planned Features</td>
<td>Mike Donohue</td>
</tr>
<tr>
<td>3:15pm - 4:15pm</td>
<td>314A</td>
<td>61790 - Electronic Document Distribution for JD Edwards World</td>
<td>Tom Carrell</td>
</tr>
</table> 

<p>Please also drop by the "Oracle Business Intelligence Enterprise Edition" demo pod (#9) in the Oracle Booth (#4780) in the Exhibit Hall if you have any questions or want to see a demo of BI Publisher Enterprise or BI EE.  You may also be able to get application specific demos at the following demo pods:</p>

<p>Oracle E-Business Suite Tools and Technology (15)<br />
JD Edwards EnterpriseOne Tools (38)<br />
PeopleSoft Enterprise PeopleTools (1) <br />
JD Edwards World Applications (40)</p>

<p>Stop by the Oracle Reception Booth after your visit to the demo pods.  I'm told that there is a "extremely retro-cool" thank you gift.</p>

<p><br />
</p>]]>
      
   </content>
</entry>

</feed>
