<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>CloverETL&#039;s Blog &#187; Hidden features</title>
	<atom:link href="http://blog.cloveretl.com/tag/hidden-features/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.cloveretl.com</link>
	<description>Life, the Universe, CloverETL and everything ...</description>
	<lastBuildDate>Thu, 15 Jul 2010 14:12:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.cloveretl.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/dd4c2411bcdf90b36e88bda58e3fce7c?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>CloverETL&#039;s Blog &#187; Hidden features</title>
		<link>http://blog.cloveretl.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.cloveretl.com/osd.xml" title="CloverETL&#039;s Blog" />
	<atom:link rel='hub' href='http://blog.cloveretl.com/?pushpress=hub'/>
		<item>
		<title>Iteration through the record fields in CTL</title>
		<link>http://blog.cloveretl.com/2010/01/25/iteration-through-the-record-fields-in-ctl/</link>
		<comments>http://blog.cloveretl.com/2010/01/25/iteration-through-the-record-fields-in-ctl/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 09:52:19 +0000</pubDate>
		<dc:creator>Vaclav Matous</dc:creator>
				<category><![CDATA[Using CloverETL]]></category>
		<category><![CDATA[CloverETL]]></category>
		<category><![CDATA[CTL]]></category>
		<category><![CDATA[Hidden features]]></category>

		<guid isPermaLink="false">http://blog.cloveretl.com/?p=368</guid>
		<description><![CDATA[Recently, I have been facing a very common problem. Imagine this scenario: I have two files – the first one with origin records and the second one with slightly modified new records. Each record had a unique key and aproximately 50 fields. My task was to compare these two files and find out how many [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.cloveretl.com&blog=7070972&post=368&subd=cloveretl&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p><!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } -->Recently, I have been facing a very common problem. Imagine this scenario: I have two files – the first one with origin records and the second one with slightly modified new records. Each record had a unique key and aproximately 50 fields. My task was to compare these two files and find out how many fields in every pair differ from each other in the corresponding records.</p>
<p><!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } -->The simplified graph can be seen in following picture:<a href="http://cloveretl.files.wordpress.com/2010/01/data_intersection.png"><img class="aligncenter size-full wp-image-369" title="data_intersection" src="http://cloveretl.files.wordpress.com/2010/01/data_intersection.png?w=663&#038;h=279" alt="" width="663" height="279" /></a></p>
<p><!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } -->A comparison of two records can be processed by the CloverETL DataIntersection component which joins the records with the same keys. In the joined records, you can compare fields that are not part of the key. But remember, you have to write the comparison in the CTL transformation <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  . Of course you could write the following block of code for each pair of compared fields:<br />
<code><br />
int count = 0;<br />
if(nvl($0.field_N, '') != nvl($1.field_N, '')) {<br />
count++;<br />
//but typically more actions <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /><br />
}<br />
//and imagine this block 50times <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /><br />
//final mapping<br />
$0.key := $0.key;<br />
$0.count := count;</code></p>
<p><!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } -->But this solution takes too much time when you have to repeat it for many fields (approx. 50 in my case). It is also very slow, uncomfortable and increases the probability of making a mistake in your code (e.g. omitting some fields). Fortunately, CloverETL allows you to  iterate through the fields of processed records! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  The code is then more briefer and more generic:<br />
<code><br />
//declaration of variables for copies of input records<br />
record(Metadata1) myrec1;<br />
record(Metadata1) myrec2;<br />
function transform() {<br />
int i = 0;<br />
int count = 0;<br />
//asign value of input records to local variables<br />
myrec1 = @0; //myrec1 is a copy of a current record on input port 0<br />
myrec2 = @1; //myrec2 is a copy of a current record on input port 1<br />
//iterate through fields, suppose that field with index 0 is the key<br />
for(i = 1; i &lt; length(myrec1); i++) {<br />
if(nvl(myrec1[i], '') != nvl(myrec2[i], '')) {<br />
count++;<br />
}<br />
}<br />
//final mapping<br />
$0.key := $0.key;<br />
$0.count := count;<br />
}</code></p>
<p><!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } -->Someone could object to the necessity of making copies of records. In this case I have good news. CTL in CloverETL version 2.9 introduces the possibility of iterating directly through the fields of input records.<br />
<code><br />
@0[i];//i-th field of the input record on port 0</code></p>
<p><!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } -->Moreover new functions for getting field names and data types are introduced in version 2.9. Personally, I am looking forward to such features that will make CTL code simplier and clearer.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cloveretl.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cloveretl.wordpress.com/368/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cloveretl.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cloveretl.wordpress.com/368/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cloveretl.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cloveretl.wordpress.com/368/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cloveretl.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cloveretl.wordpress.com/368/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cloveretl.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cloveretl.wordpress.com/368/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.cloveretl.com&blog=7070972&post=368&subd=cloveretl&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.cloveretl.com/2010/01/25/iteration-through-the-record-fields-in-ctl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/73f56f1267c1896b11e3c6df97499559?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">vmatous</media:title>
		</media:content>

		<media:content url="http://cloveretl.files.wordpress.com/2010/01/data_intersection.png" medium="image">
			<media:title type="html">data_intersection</media:title>
		</media:content>
	</item>
		<item>
		<title>Hidden features: Mutable delimiter</title>
		<link>http://blog.cloveretl.com/2009/08/18/hidden-features-mutable-delimiter/</link>
		<comments>http://blog.cloveretl.com/2009/08/18/hidden-features-mutable-delimiter/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 09:38:10 +0000</pubDate>
		<dc:creator>Petr Uher</dc:creator>
				<category><![CDATA[Using CloverETL]]></category>
		<category><![CDATA[delimited file]]></category>
		<category><![CDATA[delimiter]]></category>
		<category><![CDATA[Hidden features]]></category>
		<category><![CDATA[parsing]]></category>

		<guid isPermaLink="false">http://blog.cloveretl.com/?p=133</guid>
		<description><![CDATA[CloverETL provides a very useful feature: mutable delimiter. When you parse a delimited file (eg. CSV) you can specify different delimiter for each field. This isn&#8217;t surprising for daily CloverETL users however for users of other ETL tools it can be. It might not be very well known that in CloverETL you can even define [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.cloveretl.com&blog=7070972&post=133&subd=cloveretl&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>CloverETL provides a very useful feature: <strong>mutable delimiter</strong>. When you parse a delimited file (eg. CSV) you can specify different delimiter for each field. This isn&#8217;t surprising for daily CloverETL users however for users of other ETL tools it can be. It might not be very well known that in CloverETL you can even define more delimiters for one field (so called &#8220;mutable delimiter&#8221;) and CloverETL chooses the right one. It reveals new ways of file processing with irregular structure in CloverETL. I believe this functionality isn&#8217;t provided by  any other ETL tool on the market. If I am wrong you can leave me a message in comments. I&#8217;m always happy to find &#8220;hidden features&#8221; of other ETL tools.</p>
<p>Syntax of a mutable delimiter: delimiters have to be separated by &#8216;<code>\\|</code>&#8216;. For example if you want to define that field delimiter can be &#8216;<code>;</code>&#8216; or &#8216;<code>,</code>&#8216; or &#8216;<code>#</code>&#8216; you have to write &#8216;<code>;\\|,\\|#</code>&#8216;.<br />
The simple example of using a mutable delimiter you can download <a href="http://drop.io/cbhirdh/asset/mutabledelimiter-zip" target="_blank">here</a> as a zipped CloverETL project. The import of existing CloverETL project to your <a href="http://www.cloveretl.com/clover-gui/" target="_blank">CloverETL Designer</a> is described in <a href="http://www.cloveretl.com/_upload/clover-gui/docs/html/manual_html_chunk/ch04.html" target="_blank">CloverETL documentation</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cloveretl.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cloveretl.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cloveretl.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cloveretl.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cloveretl.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cloveretl.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cloveretl.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cloveretl.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cloveretl.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cloveretl.wordpress.com/133/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.cloveretl.com&blog=7070972&post=133&subd=cloveretl&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.cloveretl.com/2009/08/18/hidden-features-mutable-delimiter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cec19d3aab248f6f4591a97277323f2c?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">puher</media:title>
		</media:content>
	</item>
		<item>
		<title>Hidden features: Environment variables in CloverETL transformation</title>
		<link>http://blog.cloveretl.com/2009/08/11/environment-variables-in-cloveretl-transformation/</link>
		<comments>http://blog.cloveretl.com/2009/08/11/environment-variables-in-cloveretl-transformation/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 12:43:52 +0000</pubDate>
		<dc:creator>Petr Uher</dc:creator>
				<category><![CDATA[Using CloverETL]]></category>
		<category><![CDATA[environment variable]]></category>
		<category><![CDATA[graph parameter]]></category>
		<category><![CDATA[Hidden features]]></category>

		<guid isPermaLink="false">http://blog.cloveretl.com/?p=92</guid>
		<description><![CDATA[Using environment variables &#8220;Environment variable is named value that can affect the way running process will behave on a computer.&#8221; In daily praxis we usually use environment variables with different syntax depending on operation system. On UNIX-like systems we use them with the syntax: $variable_name, on DOS and Windows systems the syntax is: %variable_name%. To [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.cloveretl.com&blog=7070972&post=92&subd=cloveretl&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<h2 style="text-align:left;">Using environment variables</h2>
<p style="text-align:center;"><em>&#8220;Environment variable is named value that can affect the way running process will behave on a computer.&#8221;</em></p>
<p>In daily praxis we usually use environment variables with different syntax depending on operation system. On UNIX-like systems we use them with the syntax: <code>$variable_name</code>, on DOS and Windows systems  the syntax is: <code>%variable_name%</code>. To list the variables on UNIX-like system we can use <code>env</code> shell command, on DOS and Windows systems <code>set</code> cmd command. You can find more general information on  environment variables at <a title="Wikipedie" href="http://en.wikipedia.org/wiki/Environment_variables" target="_blank">en.wikipedie.org</a>.<br />
But enough of general information. Now how we can use environment variables in CloverETL transformation? It&#8217;s very simple, you can use it in the same way as you routinely use <a href="http://www.cloveretl.com/_upload/clover-gui/docs/html/manual_html_chunk/ch13.html" target="_blank">graph parameters</a>. So if you want to add username of the user under whom the transformation is running to your processed data, it&#8217;s nothing more than adding a new field to metadata and write following in CTL (<a href="http://www.cloveretl.com/_upload/clover-gui/docs/html/manual_html_chunk/ch25.html" target="_blank">Clover Transformation Language</a>):</p>
<blockquote><p><code>function transform(){<br />
...<br />
$0.username := '${USER}'; //UNIX-like systems<br />
OR<br />
$0.username := '${USERNAME}'; //DOS and Windows systems<br />
...<br />
}</code></p></blockquote>
<p>But <strong>be careful</strong>, value of environment variables can contain &#8220;bad characters&#8221; (<code>\,"</code>) that have to be escaped by &#8216;<code>\</code>&#8216; in CloverETL. The safest way to use env variables in CloverETL is to enclose them in quotation marks  &#8216;<code>'</code>&#8216;.</p>
<h2>Overwriting environment variables &amp; priority of parameter definitions</h2>
<p>Often it&#8217;s very helpful to use environment variables inside CloverETL transformation. But sometimes you want to define your own graph parameter with the same name as the existing environment variable has. And you may ask the question: &#8220;Is it possible?&#8221;. I answer: &#8220;Yes, it is <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .&#8221; Because there is a hierarchy of graph parameter definitions:</p>
<ol>
<li>Parameter from external parameter file specified at the start of graph execution by <code>-cfg</code> option</li>
<li>Parameter defined at the start of graph execution by <code>-P</code> option</li>
<li>Parameter from external parameter file that is linked to the graph during the graph development</li>
<li>Internal graph parameter</li>
<li>Environment variable</li>
</ol>
<p>Parameter definitions from the list are sorted by  priority (highest to  lowest). So if you have internal graph parameter with the same name as the environment variable, the value from internal parameter is always used in CloverETL.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cloveretl.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cloveretl.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cloveretl.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cloveretl.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cloveretl.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cloveretl.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cloveretl.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cloveretl.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cloveretl.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cloveretl.wordpress.com/92/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.cloveretl.com&blog=7070972&post=92&subd=cloveretl&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.cloveretl.com/2009/08/11/environment-variables-in-cloveretl-transformation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cec19d3aab248f6f4591a97277323f2c?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">puher</media:title>
		</media:content>
	</item>
		<item>
		<title>Hidden features: Note properties</title>
		<link>http://blog.cloveretl.com/2009/07/23/hidden-features-note-properties/</link>
		<comments>http://blog.cloveretl.com/2009/07/23/hidden-features-note-properties/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 01:00:11 +0000</pubDate>
		<dc:creator>Petr Uher</dc:creator>
				<category><![CDATA[Using CloverETL]]></category>
		<category><![CDATA[Hidden features]]></category>

		<guid isPermaLink="false">http://blog.cloveretl.com/?p=47</guid>
		<description><![CDATA[Do you want to have CloverETL&#8217;s graphs using nice descriptive colorful notes? Just resize your note and put the components into the area of the note as you can see on the picture. And now try to move the note. All components placed inside the note will move together with the note . The color [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.cloveretl.com&blog=7070972&post=47&subd=cloveretl&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Do you want to have CloverETL&#8217;s graphs using nice descriptive colorful notes? Just resize your note and put the components into the area of the note as you can see on the picture.</p>
<p><img class="aligncenter size-full wp-image-61" title="Graph with note" src="http://cloveretl.files.wordpress.com/2009/07/notegraph.png?w=849&#038;h=208" alt="Graph with note" width="849" height="208" /></p>
<p>And now try to move the note. All components placed inside the note will move together with the note <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .<br />
The color and the size of note&#8217;s font can be set in a Properties view (it is usually showed in the same part of eclipse windows as Console). In the same place you can also set background color of a note.</p>
<p><img class="aligncenter size-full wp-image-65" title="Properties view" src="http://cloveretl.files.wordpress.com/2009/07/propertiesview1.png?w=808&#038;h=311" alt="Properties view" width="808" height="311" /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cloveretl.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cloveretl.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cloveretl.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cloveretl.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cloveretl.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cloveretl.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cloveretl.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cloveretl.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cloveretl.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cloveretl.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.cloveretl.com&blog=7070972&post=47&subd=cloveretl&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.cloveretl.com/2009/07/23/hidden-features-note-properties/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cec19d3aab248f6f4591a97277323f2c?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">puher</media:title>
		</media:content>

		<media:content url="http://cloveretl.files.wordpress.com/2009/07/notegraph.png" medium="image">
			<media:title type="html">Graph with note</media:title>
		</media:content>

		<media:content url="http://cloveretl.files.wordpress.com/2009/07/propertiesview1.png" medium="image">
			<media:title type="html">Properties view</media:title>
		</media:content>
	</item>
	</channel>
</rss>