<?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: SQL Image field -&amp;gt;  output as raw files issue in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/SQL-Image-field-gt-output-as-raw-files-issue/m-p/2319726#M89942</link>
    <description>&lt;P&gt;I am facing the same issue.&lt;/P&gt;
&lt;P&gt;I am using the same structure,&amp;nbsp;tFlowToIterate and tIterateToFlow, but only the last file is generated, and the problem seems to be related to the name of the file:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;((String)globalMap.get("row2.FileName"))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas or workarounds for this scenario?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 05 Dec 2019 16:30:07 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-12-05T16:30:07Z</dc:date>
    <item>
      <title>SQL Image field -&gt;  output as raw files issue</title>
      <link>https://community.qlik.com/t5/Talend-Studio/SQL-Image-field-gt-output-as-raw-files-issue/m-p/2319722#M89938</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I am trying to take multiple files that were saved in a MS SQL Image field, and convert them back to their raw format.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I have tried following suggestions in the following thread:&amp;nbsp;&lt;A href="https://community.qlik.com/s/feed/0D53p00007vCo74CAC" target="_blank"&gt;https://community.talend.com/t5/Design-and-Development/resolved-Create-file-from-a-blob-input-oracle-db/td-p/92265&lt;/A&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;My issue currently is that the job appears to be correctly looping through each IMAGE, but the tFileExportRaw is&amp;nbsp;not correctly setting the filename.&amp;nbsp;(See image1)&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;The following is the code in my tJavaRow&lt;/P&gt; 
&lt;PRE&gt;ByteArrayOutputStream baos = new ByteArrayOutputStream();
java.sql.Blob blob = (java.sql.Blob)input_row.Document;
byte[] buf = new byte[1024];
java.io.InputStream in = blob.getBinaryStream();
int n = 0;
while ((n=in.read(buf))&amp;gt;=0)
{
baos.write(buf, 0, n);
}
in.close();
byte[] bytes = baos.toByteArray();

output_row.IMAGE = bytes;
output_row.filename = input_row.Fld1 + "-" + input_row.DocId + "." + input_row.FileExtension;


System.out.println(((String)output_row.filename)); //this correctly displays each file name.&lt;/PRE&gt; 
&lt;P&gt;tFlowToIterate is set at defaults&lt;/P&gt; 
&lt;P&gt;See image2 for my tIterateToFlow setup.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Finally, the tFileOutputRow filename is set to:&amp;nbsp; &amp;nbsp;"C:/dev/DMSOut/" +&amp;nbsp; row3.filename&lt;/P&gt; 
&lt;P&gt;With this setup, no value (null) is being passed through to the row3.filename, and the files overwrite each other leaving 1 file named "null".&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I also tried exactly as the previously linked post instructed, and only the last item's filename is passed through. Thus, the files all overwrite eachother and I am left with 1 file.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Sep 2018 23:04:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/SQL-Image-field-gt-output-as-raw-files-issue/m-p/2319722#M89938</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-09-28T23:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Image field -&gt;  output as raw files issue</title>
      <link>https://community.qlik.com/t5/Talend-Studio/SQL-Image-field-gt-output-as-raw-files-issue/m-p/2319723#M89939</link>
      <description>&lt;P&gt;You don't need use tIterateToFlow in case if You want to store each file separately&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;in combination&amp;nbsp;with flow output component create file once, but not for each row&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;You must use tFlowToIterate and do iteration for each row independent&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;as variant:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;tFlowToIterate -&amp;gt; on ComponentOk -&amp;gt; tJava (assign global variable to output column) -&amp;gt; tFileOutput (with iterational name)&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;this is will work for each iteration independently&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Sep 2018 23:19:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/SQL-Image-field-gt-output-as-raw-files-issue/m-p/2319723#M89939</guid>
      <dc:creator>vapukov</dc:creator>
      <dc:date>2018-09-28T23:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Image field -&gt;  output as raw files issue</title>
      <link>https://community.qlik.com/t5/Talend-Studio/SQL-Image-field-gt-output-as-raw-files-issue/m-p/2319724#M89940</link>
      <description>&lt;P&gt;I have tried your advice as best as I could, and have not been successful getting the job to generate unique files for each row (with a dynamic filename as set in the tJavaRow).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you elaborate on "&lt;SPAN&gt;You must use tFlowToIterate and do iteration for each row independent" ? How do I connect the tFlowToIterate to my tFileOutputRaw ?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Oct 2018 16:31:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/SQL-Image-field-gt-output-as-raw-files-issue/m-p/2319724#M89940</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-03T16:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Image field -&gt;  output as raw files issue</title>
      <link>https://community.qlik.com/t5/Talend-Studio/SQL-Image-field-gt-output-as-raw-files-issue/m-p/2319725#M89941</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2018-10-05 at 01.37.22.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LySr.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/157263iA4E722A07A116650/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LySr.png" alt="0683p000009LySr.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;tJava - it is your code&lt;/P&gt; 
&lt;P&gt;tJavasFlex_2 - dummy connector&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;tJavaFlex_1&lt;/P&gt; 
&lt;PRE&gt;row3.IMAGE=(byte[])globalMap.get("row2.IMAGE");&lt;/PRE&gt; 
&lt;P&gt;filename in tFileOutput&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2018-10-05 at 01.38.14.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M0BC.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/135271iB481465543221EAA/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M0BC.png" alt="0683p000009M0BC.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 14:26:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/SQL-Image-field-gt-output-as-raw-files-issue/m-p/2319725#M89941</guid>
      <dc:creator>vapukov</dc:creator>
      <dc:date>2018-10-04T14:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Image field -&gt;  output as raw files issue</title>
      <link>https://community.qlik.com/t5/Talend-Studio/SQL-Image-field-gt-output-as-raw-files-issue/m-p/2319726#M89942</link>
      <description>&lt;P&gt;I am facing the same issue.&lt;/P&gt;
&lt;P&gt;I am using the same structure,&amp;nbsp;tFlowToIterate and tIterateToFlow, but only the last file is generated, and the problem seems to be related to the name of the file:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;((String)globalMap.get("row2.FileName"))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas or workarounds for this scenario?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 16:30:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/SQL-Image-field-gt-output-as-raw-files-issue/m-p/2319726#M89942</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-12-05T16:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Image field -&gt;  output as raw files issue</title>
      <link>https://community.qlik.com/t5/Talend-Studio/SQL-Image-field-gt-output-as-raw-files-issue/m-p/2319727#M89943</link>
      <description>My bad, the last post from vapukov contains the solution!&lt;BR /&gt;Thanks</description>
      <pubDate>Thu, 05 Dec 2019 16:41:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/SQL-Image-field-gt-output-as-raw-files-issue/m-p/2319727#M89943</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-12-05T16:41:54Z</dc:date>
    </item>
  </channel>
</rss>

