<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: [resolved] Excel to XML: dynamically define columns to process in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-Excel-to-XML-dynamically-define-columns-to-process/m-p/2324251#M93980</link>
    <description>Thanks!
&lt;BR /&gt;I put up a blog post on this with screen shots 
&lt;A href="http://bekwam.blogspot.com/2011/11/dynamically-filtering-columns-for-xml.html" rel="nofollow noopener noreferrer"&gt;http://bekwam.blogspot.com/2011/11/dynamically-filtering-columns-for-xml.html&lt;/A&gt;
&lt;BR /&gt;The post works with Java Reflection so it avoids coding the column names with expressions like "input_row.shelf".</description>
    <pubDate>Tue, 22 Nov 2011 14:06:45 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2011-11-22T14:06:45Z</dc:date>
    <item>
      <title>[resolved] Excel to XML: dynamically define columns to process</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Excel-to-XML-dynamically-define-columns-to-process/m-p/2324248#M93977</link>
      <description>Hi TALEND-community, 
&lt;BR /&gt;I've started using TOS only last week and so far I'm impressed by the functional range of the tool. 
&lt;BR /&gt;Still I encountered a problem I cannot see a simple solution for and seems like it has been discussed in similar ways before here in this forum. The task I want to accomplish is reading data from a XLS file and write the data to XML. The XLS source files are varying a little form one file to another and have different number of columns. Additionally not all columns existing in an XLS file need to be written to XML. 
&lt;BR /&gt;I will have a kind of job configuration file which includes the list of columns I want to import for each XLS file, e.g. or . What I already know (or at least I think I know) is that a scheme for a tFileInputExcel-component cannot be dynamic, which IMHO means a) I will have to read all columns which might occur (e.g. A-Z or even more) and b) the reduction of columns will have to take place after the data extraction based on the rules read from the configuration file. 
&lt;BR /&gt;The good thing is that the target scheme of the XML file is kind of generic, which means there are no specific target fields for individual source fields: 
&lt;BR /&gt;&amp;lt;measure id="COLUMN_TITLE"&amp;gt; &amp;lt; octetmeasure value="VALUE"/&amp;gt; &amp;lt;/measure&amp;gt; 
&lt;BR /&gt;If I use my two samples above the result should be either 
&lt;BR /&gt; &amp;lt;measures &amp;gt; 
&lt;BR /&gt; &amp;lt;measure id="A"&amp;gt; &amp;lt; octetmeasure value="value1"/&amp;gt; &amp;lt;/measure&amp;gt; 
&lt;BR /&gt; &amp;lt;measure id="B "&amp;gt; &amp;lt; octetmeasure value="value2"/&amp;gt; &amp;lt;/measure&amp;gt; 
&lt;BR /&gt; &amp;lt;measure id="D "&amp;gt; &amp;lt; octetmeasure value="value3"/&amp;gt; &amp;lt;/measure&amp;gt; 
&lt;BR /&gt; &amp;lt;measure id="G "&amp;gt; &amp;lt; octetmeasure value="value4"/&amp;gt; &amp;lt;/measure&amp;gt; 
&lt;BR /&gt; &amp;lt;measure id="H "&amp;gt; &amp;lt; octetmeasure value="value5"/&amp;gt; &amp;lt;/measure&amp;gt; 
&lt;BR /&gt; &amp;lt;measure id="K "&amp;gt; &amp;lt; octetmeasure value="value6"/&amp;gt; &amp;lt;/measure&amp;gt; 
&lt;BR /&gt; &amp;lt;/measures &amp;gt; 
&lt;BR /&gt;or it should be 
&lt;BR /&gt; &amp;lt;measures &amp;gt; 
&lt;BR /&gt; &amp;lt;measure id="A"&amp;gt; &amp;lt; octetmeasure value="value1"/&amp;gt; &amp;lt;/measure&amp;gt; 
&lt;BR /&gt; &amp;lt;measure id="B "&amp;gt; &amp;lt; octetmeasure value="value2"/&amp;gt; &amp;lt;/measure&amp;gt; 
&lt;BR /&gt; &amp;lt;measure id="C "&amp;gt; &amp;lt; octetmeasure value="value3"/&amp;gt; &amp;lt;/measure&amp;gt; 
&lt;BR /&gt; &amp;lt;measure id="D "&amp;gt; &amp;lt; octetmeasure value="value4"/&amp;gt; &amp;lt;/measure&amp;gt; 
&lt;BR /&gt; &amp;lt;measure id="E "&amp;gt; &amp;lt; octetmeasure value="value5"/&amp;gt; &amp;lt;/measure&amp;gt; 
&lt;BR /&gt; &amp;lt;measure id="F "&amp;gt; &amp;lt; octetmeasure value="value6"/&amp;gt; &amp;lt;/measure&amp;gt; 
&lt;BR /&gt; &amp;lt;measure id="K "&amp;gt; &amp;lt; octetmeasure value="value7"/&amp;gt; &amp;lt;/measure&amp;gt; 
&lt;BR /&gt; &amp;lt;/measures &amp;gt; 
&lt;BR /&gt; 
&lt;BR /&gt;Ignoring single rows based on filter criteria is straight-forward, but how can I achieve something like this for columns? Maybe a solution with individual java code? Any idea is welcome! 
&lt;BR /&gt;Thank you! 
&lt;BR /&gt;Michael</description>
      <pubDate>Sat, 16 Nov 2024 12:33:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Excel-to-XML-dynamically-define-columns-to-process/m-p/2324248#M93977</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T12:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Excel to XML: dynamically define columns to process</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Excel-to-XML-dynamically-define-columns-to-process/m-p/2324249#M93978</link>
      <description>Hi,
&lt;BR /&gt;Start by defining an Excel schema that includes all columns. Drag this on the canvas as an input component.
&lt;BR /&gt;Add a tJavaRow and a tFileOutputMSXML. Synchronize all columns. In the tFileOutputMSXML, uncheck the "Create empty element if needed" checkbox.
&lt;BR /&gt;In the tJavaRow, filter the row values based on the column logic. For example, if I have a context variable "OUTPUT_COLUMNS" that's set to a list of column names "brand,type,shelf", I can use logic like this filter. Note the ternary operator which will swap a null for an empty string of an unfiltered column. For a more general case, you might fill up a hashmap from a file or database record containing a list of columns. Then, the tJavaRow would iterate over the column names rather than have them hardcoded.
&lt;BR /&gt;if( context.OUTPUT_COLUMNS.contains("shelf") ) {
&lt;BR /&gt; output_row.shelf = (input_row.shelf!=null)?input_row.shelf:"";
&lt;BR /&gt;}
&lt;BR /&gt;The result is an XML document that doesn't have elements for the filtered columns, but will return an empty element for empty unfiltered columns.</description>
      <pubDate>Tue, 22 Nov 2011 13:16:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Excel-to-XML-dynamically-define-columns-to-process/m-p/2324249#M93978</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-11-22T13:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Excel to XML: dynamically define columns to process</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Excel-to-XML-dynamically-define-columns-to-process/m-p/2324250#M93979</link>
      <description>Dear walkerca,&lt;BR /&gt;thank you for your detailed suggestion. I will let you know if I succeded.&lt;BR /&gt;Btw: your blog @ &lt;A href="http://bekwam.blogspot.com" rel="nofollow noopener noreferrer"&gt;http://bekwam.blogspot.com&lt;/A&gt; has been a very useful source of information in the last days. Please keep up the good work, it's highly appreciated!&lt;BR /&gt;Michael</description>
      <pubDate>Tue, 22 Nov 2011 13:23:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Excel-to-XML-dynamically-define-columns-to-process/m-p/2324250#M93979</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-11-22T13:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Excel to XML: dynamically define columns to process</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Excel-to-XML-dynamically-define-columns-to-process/m-p/2324251#M93980</link>
      <description>Thanks!
&lt;BR /&gt;I put up a blog post on this with screen shots 
&lt;A href="http://bekwam.blogspot.com/2011/11/dynamically-filtering-columns-for-xml.html" rel="nofollow noopener noreferrer"&gt;http://bekwam.blogspot.com/2011/11/dynamically-filtering-columns-for-xml.html&lt;/A&gt;
&lt;BR /&gt;The post works with Java Reflection so it avoids coding the column names with expressions like "input_row.shelf".</description>
      <pubDate>Tue, 22 Nov 2011 14:06:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Excel-to-XML-dynamically-define-columns-to-process/m-p/2324251#M93980</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-11-22T14:06:45Z</dc:date>
    </item>
  </channel>
</rss>

