<?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 How to use table query results in tRowGenerator in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-table-query-results-in-tRowGenerator/m-p/2223503#M16610</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;/P&gt; 
&lt;DIV&gt;
  &amp;nbsp; 
&lt;/DIV&gt; 
&lt;DIV&gt;
  If I'm in the wrong board, I apologize - I'm new to Talend and the Community. 
&lt;/DIV&gt; 
&lt;DIV&gt;
  &amp;nbsp; 
&lt;/DIV&gt; 
&lt;DIV&gt;
  I have a functionality question with tRowGenerator.&amp;nbsp; I'd like to generate random values based on a query from a table.&amp;nbsp; Is this possible to do?&amp;nbsp; If so, how? 
&lt;/DIV&gt; 
&lt;DIV&gt;
  &amp;nbsp; 
&lt;/DIV&gt; 
&lt;DIV&gt;
  If I hard-code a string of values, this works: 
&lt;/DIV&gt; 
&lt;DIV&gt; 
 &lt;DIV&gt; 
  &lt;IMG src="https://community.qlik.com/" alt="image.png" width="542" height="166" border="0" /&gt; 
 &lt;/DIV&gt; 
 &lt;DIV&gt; 
  &lt;DIV class="m_808396651340391905gmail_signature"&gt; 
   &lt;DIV&gt; 
    &lt;DIV&gt; 
     &lt;DIV&gt; 
      &lt;DIV&gt; 
       &lt;DIV&gt; 
        &lt;P&gt;&amp;nbsp;&lt;/P&gt; 
        &lt;P&gt;I've tried variations using a context variable, thinking I can load from the table the list, denormalize it, and then load to the context variable.&amp;nbsp; Once that is done, tRowGenerator does it's thing.&amp;nbsp; But I can't get that to work:&lt;/P&gt; 
        &lt;DIV&gt; 
         &lt;IMG src="https://community.qlik.com/" alt="image.png" border="0" /&gt; 
        &lt;/DIV&gt; 
        &lt;P&gt;&amp;nbsp;&lt;/P&gt; 
        &lt;P&gt;I've tried changing the type from String to List, but can't seem to get it to work.&lt;/P&gt; 
        &lt;P&gt;When I hard code the list, TOS generates this following Java code:&lt;/P&gt; 
        &lt;P&gt;&amp;nbsp;&lt;/P&gt; 
        &lt;P&gt;public String getRandomCredentials() {&lt;/P&gt; 
        &lt;P&gt;String[] CredentialsTable = new String[] { "MD", "DO",&lt;BR /&gt;"FNP", "AGNP", "DDS" };&lt;BR /&gt;java.util.Random randomtRowGenerator_1 = new java.util.Random();&lt;BR /&gt;return CredentialsTable[randomtRowGenerator_1&lt;BR /&gt;.nextInt(CredentialsTable.length)];&lt;/P&gt; 
        &lt;P&gt;}&lt;/P&gt; 
        &lt;P&gt;&amp;nbsp;&lt;/P&gt; 
        &lt;P&gt;But when I use a context variable, it doesn't "randomize it".&amp;nbsp; It just returns the values in the context variable as a single string:&lt;/P&gt; 
        &lt;P&gt;&amp;nbsp;&lt;/P&gt; 
        &lt;P&gt;public String getRandomCredentials() {&lt;/P&gt; 
        &lt;P&gt;return context.Credentials;&lt;/P&gt; 
        &lt;P&gt;}&lt;/P&gt; 
        &lt;P&gt;&amp;nbsp;&lt;/P&gt; 
        &lt;P&gt;Any help is appreciated!&lt;/P&gt; 
       &lt;/DIV&gt; 
      &lt;/DIV&gt; 
     &lt;/DIV&gt; 
    &lt;/DIV&gt; 
   &lt;/DIV&gt; 
  &lt;/DIV&gt; 
 &lt;/DIV&gt; 
&lt;/DIV&gt;</description>
    <pubDate>Fri, 30 Aug 2019 16:28:08 GMT</pubDate>
    <dc:creator>Papademuchos</dc:creator>
    <dc:date>2019-08-30T16:28:08Z</dc:date>
    <item>
      <title>How to use table query results in tRowGenerator</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-table-query-results-in-tRowGenerator/m-p/2223503#M16610</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;/P&gt; 
&lt;DIV&gt;
  &amp;nbsp; 
&lt;/DIV&gt; 
&lt;DIV&gt;
  If I'm in the wrong board, I apologize - I'm new to Talend and the Community. 
&lt;/DIV&gt; 
&lt;DIV&gt;
  &amp;nbsp; 
&lt;/DIV&gt; 
&lt;DIV&gt;
  I have a functionality question with tRowGenerator.&amp;nbsp; I'd like to generate random values based on a query from a table.&amp;nbsp; Is this possible to do?&amp;nbsp; If so, how? 
&lt;/DIV&gt; 
&lt;DIV&gt;
  &amp;nbsp; 
&lt;/DIV&gt; 
&lt;DIV&gt;
  If I hard-code a string of values, this works: 
&lt;/DIV&gt; 
&lt;DIV&gt; 
 &lt;DIV&gt; 
  &lt;IMG src="https://community.qlik.com/" alt="image.png" width="542" height="166" border="0" /&gt; 
 &lt;/DIV&gt; 
 &lt;DIV&gt; 
  &lt;DIV class="m_808396651340391905gmail_signature"&gt; 
   &lt;DIV&gt; 
    &lt;DIV&gt; 
     &lt;DIV&gt; 
      &lt;DIV&gt; 
       &lt;DIV&gt; 
        &lt;P&gt;&amp;nbsp;&lt;/P&gt; 
        &lt;P&gt;I've tried variations using a context variable, thinking I can load from the table the list, denormalize it, and then load to the context variable.&amp;nbsp; Once that is done, tRowGenerator does it's thing.&amp;nbsp; But I can't get that to work:&lt;/P&gt; 
        &lt;DIV&gt; 
         &lt;IMG src="https://community.qlik.com/" alt="image.png" border="0" /&gt; 
        &lt;/DIV&gt; 
        &lt;P&gt;&amp;nbsp;&lt;/P&gt; 
        &lt;P&gt;I've tried changing the type from String to List, but can't seem to get it to work.&lt;/P&gt; 
        &lt;P&gt;When I hard code the list, TOS generates this following Java code:&lt;/P&gt; 
        &lt;P&gt;&amp;nbsp;&lt;/P&gt; 
        &lt;P&gt;public String getRandomCredentials() {&lt;/P&gt; 
        &lt;P&gt;String[] CredentialsTable = new String[] { "MD", "DO",&lt;BR /&gt;"FNP", "AGNP", "DDS" };&lt;BR /&gt;java.util.Random randomtRowGenerator_1 = new java.util.Random();&lt;BR /&gt;return CredentialsTable[randomtRowGenerator_1&lt;BR /&gt;.nextInt(CredentialsTable.length)];&lt;/P&gt; 
        &lt;P&gt;}&lt;/P&gt; 
        &lt;P&gt;&amp;nbsp;&lt;/P&gt; 
        &lt;P&gt;But when I use a context variable, it doesn't "randomize it".&amp;nbsp; It just returns the values in the context variable as a single string:&lt;/P&gt; 
        &lt;P&gt;&amp;nbsp;&lt;/P&gt; 
        &lt;P&gt;public String getRandomCredentials() {&lt;/P&gt; 
        &lt;P&gt;return context.Credentials;&lt;/P&gt; 
        &lt;P&gt;}&lt;/P&gt; 
        &lt;P&gt;&amp;nbsp;&lt;/P&gt; 
        &lt;P&gt;Any help is appreciated!&lt;/P&gt; 
       &lt;/DIV&gt; 
      &lt;/DIV&gt; 
     &lt;/DIV&gt; 
    &lt;/DIV&gt; 
   &lt;/DIV&gt; 
  &lt;/DIV&gt; 
 &lt;/DIV&gt; 
&lt;/DIV&gt;</description>
      <pubDate>Fri, 30 Aug 2019 16:28:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-table-query-results-in-tRowGenerator/m-p/2223503#M16610</guid>
      <dc:creator>Papademuchos</dc:creator>
      <dc:date>2019-08-30T16:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to use table query results in tRowGenerator</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-table-query-results-in-tRowGenerator/m-p/2223504#M16611</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/0053900000786VTAAY"&gt;@Papademuchos&lt;/A&gt;&amp;nbsp; and welcome to the Community!&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I'm afraid your screenshots are not available to view. I have checked the HTML and it looks like you are sharing from Google. This does not allow others to view this. Could you use the Photos button at the top of the post window and add these?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Regarding your question, I think you may need to use a tMap and call the methods using Java in-line IFs to do this. I may be wrong since I am missing the images, but you might want to try that.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 11:21:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-table-query-results-in-tRowGenerator/m-p/2223504#M16611</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-02T11:21:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use table query results in tRowGenerator</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-table-query-results-in-tRowGenerator/m-p/2223505#M16612</link>
      <description>&lt;P&gt;Hello, hopefully these images will come through better.&amp;nbsp; The first one is showing the literal string in the Expression Value in tRowGenerator.&amp;nbsp; It accurately randomizes my five values among the generated rows:&amp;nbsp; "AGNP","DDS","DO","FNP","MD".&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="Talend1.jpg" style="width: 739px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M6e0.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/139604iCC660B5B73D5CDF7/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M6e0.jpg" alt="0683p000009M6e0.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;The second one is my attempt to pull the values from a database table and put them into a context variable.&amp;nbsp; I can do that part just fine, but tRowGenerator doesn't see them as a list of values, but a single value.&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Talend2.jpg" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M6uQ.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/155732i66B8B4589C53F2FC/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M6uQ.jpg" alt="0683p000009M6uQ.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 15:34:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-table-query-results-in-tRowGenerator/m-p/2223505#M16612</guid>
      <dc:creator>Papademuchos</dc:creator>
      <dc:date>2019-09-04T15:34:30Z</dc:date>
    </item>
  </channel>
</rss>

