<?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 Concatenate Rows into a JSON String in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Concatenate-Rows-into-a-JSON-String/m-p/2270124#M48135</link>
    <description>I need to write a job that reads rows from a table and posts those records to a REST Web service with a JSON Object.&lt;BR /&gt;I'm newer to Talend so I need some advice. &amp;nbsp;how/or which is the best way to concatenate rows into a JSON string object?&lt;BR /&gt;I tried using a THashInput component to hold the rows and then a tJava components to loop through the records but this just gives me one record at a time. &amp;nbsp;Is there a way I could write a loop that would read all the records from the&amp;nbsp;tHashInput&amp;nbsp;object?&lt;BR /&gt;&lt;PRE&gt;int currentRow=0;&lt;BR /&gt;while (currentRow&amp;lt;= tHashInput.lenght90)&lt;BR /&gt;{&lt;BR /&gt;//create a JsonString with 10 row records each&lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;for(i=0; i&amp;lt;=10; i++)&lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;JsonString = JsonString &amp;nbsp;+ "{\"u_Name\": \"" +row7.name + "\"}";&lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;currentRow = &lt;FONT size="2"&gt;currentRow+1;&lt;/FONT&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;How can I read rows and concatenate their data into a single string?</description>
    <pubDate>Mon, 04 May 2015 18:30:35 GMT</pubDate>
    <dc:creator>_AnonymousUser</dc:creator>
    <dc:date>2015-05-04T18:30:35Z</dc:date>
    <item>
      <title>Concatenate Rows into a JSON String</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Concatenate-Rows-into-a-JSON-String/m-p/2270124#M48135</link>
      <description>I need to write a job that reads rows from a table and posts those records to a REST Web service with a JSON Object.&lt;BR /&gt;I'm newer to Talend so I need some advice. &amp;nbsp;how/or which is the best way to concatenate rows into a JSON string object?&lt;BR /&gt;I tried using a THashInput component to hold the rows and then a tJava components to loop through the records but this just gives me one record at a time. &amp;nbsp;Is there a way I could write a loop that would read all the records from the&amp;nbsp;tHashInput&amp;nbsp;object?&lt;BR /&gt;&lt;PRE&gt;int currentRow=0;&lt;BR /&gt;while (currentRow&amp;lt;= tHashInput.lenght90)&lt;BR /&gt;{&lt;BR /&gt;//create a JsonString with 10 row records each&lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;for(i=0; i&amp;lt;=10; i++)&lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;JsonString = JsonString &amp;nbsp;+ "{\"u_Name\": \"" +row7.name + "\"}";&lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;currentRow = &lt;FONT size="2"&gt;currentRow+1;&lt;/FONT&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;How can I read rows and concatenate their data into a single string?</description>
      <pubDate>Mon, 04 May 2015 18:30:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Concatenate-Rows-into-a-JSON-String/m-p/2270124#M48135</guid>
      <dc:creator>_AnonymousUser</dc:creator>
      <dc:date>2015-05-04T18:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate Rows into a JSON String</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Concatenate-Rows-into-a-JSON-String/m-p/2270125#M48136</link>
      <description>Hello
&lt;BR /&gt;Take a look tJavaFlex component, you can initialize a string in the begin part, and concatenate all the input records in the main part, and finally, store the string to global variable for used later on other component, you can find some explanation and an example about tJavaFlex in this KB 
&lt;A href="https://help.talend.com/pages/viewpage.action?pageId=190513463" target="_blank" rel="nofollow noopener noreferrer"&gt;article&lt;/A&gt;, let me know if you have any doubts.
&lt;BR /&gt;Best regards
&lt;BR /&gt;Shong</description>
      <pubDate>Fri, 08 May 2015 11:58:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Concatenate-Rows-into-a-JSON-String/m-p/2270125#M48136</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-08T11:58:13Z</dc:date>
    </item>
  </channel>
</rss>

