<?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] output_row dynamic field access in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-output-row-dynamic-field-access/m-p/2361749#M126034</link>
    <description>Yes, the solution &lt;I&gt;setColumn(String name, Object value)&lt;/I&gt; could be a great help ....</description>
    <pubDate>Thu, 23 Jul 2009 08:08:41 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-07-23T08:08:41Z</dc:date>
    <item>
      <title>[resolved] output_row dynamic field access</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-output-row-dynamic-field-access/m-p/2361746#M126031</link>
      <description>Hello&lt;BR /&gt;I have this input schema (simple example) :&lt;BR /&gt;Identifier ; Col1 ; Col2 ; Col3&lt;BR /&gt;A ; 1 ; 10 ; 2.3&lt;BR /&gt;B ; 11 ; 152&lt;BR /&gt;C ; 4.5 ; 1 ; 12 ; 1.8&lt;BR /&gt;I want this output : &lt;BR /&gt;A1 ; A2 ; A3 ; B1 ; B2 ; C1 ; C2 ; C3 ; C4&lt;BR /&gt;1 ; 10 ; 2.3 ; 11 ; 152 ; 4.5 ; 1 ; 12 ; 1.8&lt;BR /&gt;I don't know how to do this with tMap or other component, so I try to use tJavaRow. But the output field row depends of the input Identifier column value, and I don't know how to access the output field row dynamically. Something like this ... :&lt;BR /&gt;output_row = input_row.col1&lt;BR /&gt;output_row = input_row.col2&lt;BR /&gt;...&lt;BR /&gt;Someone can help me ?&lt;BR /&gt;Thx</description>
      <pubDate>Sat, 16 Nov 2024 13:52:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-output-row-dynamic-field-access/m-p/2361746#M126031</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T13:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] output_row dynamic field access</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-output-row-dynamic-field-access/m-p/2361747#M126032</link>
      <description>Hi
&lt;BR /&gt;No reply, but I found a solution to my problem, so I post it, maybe it will be usefull for another guy ...
&lt;BR /&gt;I user a tJavaRow, with my input shema and my output schema (output shema is different from input) : 
&lt;BR /&gt;For my example, it give that :
&lt;BR /&gt;
&lt;PRE&gt;String s;&lt;BR /&gt;String value;&lt;BR /&gt;for(int i=1;i&amp;lt;=3;i++)&lt;BR /&gt;{	&lt;BR /&gt;	s = String.valueOf(i);&lt;BR /&gt;	value = (String)input_row.getClass().getDeclaredField("Column"+i).get(input_row);&lt;BR /&gt;	if (value != null &amp;amp;&amp;amp; !value.equals(""))&lt;BR /&gt;	{&lt;BR /&gt;		java.lang.reflect.Field f = output_row.getClass().getDeclaredField(input_row.Identifier+s);&lt;BR /&gt;		if (f.getType() == BigDecimal.class)&lt;BR /&gt;		{&lt;BR /&gt;			f.set(output_row, new BigDecimal(value));&lt;BR /&gt;		}&lt;BR /&gt;		else&lt;BR /&gt;		{&lt;BR /&gt;			f.set(output_row, value);&lt;BR /&gt;		}&lt;BR /&gt;	}&lt;BR /&gt;}&lt;/PRE&gt;
&lt;BR /&gt;It was more a Java problem than a Talend problem.
&lt;BR /&gt;This code generate multiple lines, but only the last one is complete. So I use another Field in which I put an increment, then I use a tSortRow (sort desc on my field) and a tSampleRow to keep only the first row. If someone has a best solution to do this .... 
&lt;BR /&gt;Bye</description>
      <pubDate>Wed, 22 Jul 2009 13:41:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-output-row-dynamic-field-access/m-p/2361747#M126032</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-07-22T13:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] output_row dynamic field access</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-output-row-dynamic-field-access/m-p/2361748#M126033</link>
      <description>Hi, 
&lt;BR /&gt;thanks for posting your solution (even if no one could help you out). I read your post and thought about reflection too. But didn't got the time to think more about this (or even wrote an example). In Perl it is much easier, because the values are stored in a hash. I think this is something where some optimization in Talend are possible: Allow (additional to the actual fields) to set values by there name as an parameter: setColumn(String name, Object value) 
&lt;BR /&gt;Bye 
&lt;BR /&gt;Volker</description>
      <pubDate>Wed, 22 Jul 2009 21:55:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-output-row-dynamic-field-access/m-p/2361748#M126033</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-07-22T21:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] output_row dynamic field access</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-output-row-dynamic-field-access/m-p/2361749#M126034</link>
      <description>Yes, the solution &lt;I&gt;setColumn(String name, Object value)&lt;/I&gt; could be a great help ....</description>
      <pubDate>Thu, 23 Jul 2009 08:08:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-output-row-dynamic-field-access/m-p/2361749#M126034</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-07-23T08:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] output_row dynamic field access</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-output-row-dynamic-field-access/m-p/2361750#M126035</link>
      <description>I added a feature request:&lt;BR /&gt;8407</description>
      <pubDate>Thu, 23 Jul 2009 20:14:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-output-row-dynamic-field-access/m-p/2361750#M126035</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-07-23T20:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] output_row dynamic field access</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-output-row-dynamic-field-access/m-p/2361751#M126036</link>
      <description>Hi,&lt;BR /&gt;My issue is somewhat related to this topic.&lt;BR /&gt;At design time, I do not know the column names of a CSV file, but they are present in the first row as header. I just need to create an XML file containing the corresponding columns and the data.&lt;BR /&gt;Say for ex, below is my data in CSV,&lt;BR /&gt;ID,Name,Age&lt;BR /&gt;1,qwerty,12&lt;BR /&gt;2,asdf,11&lt;BR /&gt;3,zxcvb,10&lt;BR /&gt;I have to generate an XML file like this:&lt;BR /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;BR /&gt;&amp;lt;entities&amp;gt;&lt;BR /&gt;    &amp;lt;entity&amp;gt;&lt;BR /&gt;        &amp;lt;field name="ID" value="1"/&amp;gt;&lt;BR /&gt;        &amp;lt;field name="Name" value="qwerty"/&amp;gt;&lt;BR /&gt;        &amp;lt;field name="Age" value="12"/&amp;gt;&lt;BR /&gt;    &amp;lt;/entity&amp;gt;&lt;BR /&gt;        &amp;lt;entity&amp;gt;&lt;BR /&gt;        &amp;lt;field name="ID" value="2"/&amp;gt;&lt;BR /&gt;        &amp;lt;field name="Name" value="asdf"/&amp;gt;&lt;BR /&gt;        &amp;lt;field name="Age" value="11"/&amp;gt;&lt;BR /&gt;    &amp;lt;/entity&amp;gt;&lt;BR /&gt;         &amp;lt;entity&amp;gt;&lt;BR /&gt;        &amp;lt;field name="ID" value="3"/&amp;gt;&lt;BR /&gt;        &amp;lt;field name="Name" value="zxcvb"/&amp;gt;&lt;BR /&gt;        &amp;lt;field name="Age" value="10"/&amp;gt;&lt;BR /&gt;    &amp;lt;/entity&amp;gt;&lt;BR /&gt;&amp;lt;/entities&amp;gt;&lt;BR /&gt;If anybody can help me out with the Java code to be written for this, it would be very helpful.&lt;BR /&gt;Thanks in advance,&lt;BR /&gt;Rashmitha</description>
      <pubDate>Mon, 09 Apr 2012 07:42:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-output-row-dynamic-field-access/m-p/2361751#M126036</guid>
      <dc:creator>_AnonymousUser</dc:creator>
      <dc:date>2012-04-09T07:42:06Z</dc:date>
    </item>
  </channel>
</rss>

