<?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: How to get random value from a colum on a table for each row? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-get-random-value-from-a-colum-on-a-table-for-each-row/m-p/2300776#M72969</link>
    <description>Hi Rolo,&lt;BR /&gt;Welcome to the forum.&lt;BR /&gt;Your subquery has an extra comma, so will fail on a syntax error.  Did you try putting the tOracleInput to a tLogrow to confirm that it is returning only one row (it should based on ROWNUM = 1)?&lt;BR /&gt;In your tMap  did you drag a field from the main flow onto the primary key of the lookup row to enforce a match?  Also, did you specify the tMap join type to inner join?&lt;BR /&gt;Thanks,&lt;BR /&gt;Ben</description>
    <pubDate>Fri, 25 May 2012 18:05:27 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-05-25T18:05:27Z</dc:date>
    <item>
      <title>How to get random value from a colum on a table for each row?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-get-random-value-from-a-colum-on-a-table-for-each-row/m-p/2300775#M72968</link>
      <description>How can you get a random value from a table in a oracle DB?
&lt;BR /&gt;I used this query with a tOracleInput:
&lt;BR /&gt;SELECT * FROM table_name
&lt;BR /&gt;WHERE primary_key IN
&lt;BR /&gt;(SELECT primary_key FROM
&lt;BR /&gt; (SELECT primary_key, FROM table_name ORDER BY SYS.DBMS_RANDOM.RANDOM 2)
&lt;BR /&gt; WHERE rownum &amp;lt;= 10)
&lt;BR /&gt;AND ROWNUM = 1;
&lt;BR /&gt;Returns a random row.
&lt;BR /&gt;With a TMap component I tried to use the output of tOracleInput, I selected "reload at each row", but returns all rows in the tabla_name and combines each row with each of the TMAP main flow.
&lt;BR /&gt;I want to get one row for each row in the main flow, not a Cartesian product of rows of each flow.
&lt;BR /&gt;Sorry for my English
&lt;BR /&gt;regards
&lt;BR /&gt;Thanks in advance</description>
      <pubDate>Fri, 25 May 2012 17:22:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-get-random-value-from-a-colum-on-a-table-for-each-row/m-p/2300775#M72968</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-25T17:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to get random value from a colum on a table for each row?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-get-random-value-from-a-colum-on-a-table-for-each-row/m-p/2300776#M72969</link>
      <description>Hi Rolo,&lt;BR /&gt;Welcome to the forum.&lt;BR /&gt;Your subquery has an extra comma, so will fail on a syntax error.  Did you try putting the tOracleInput to a tLogrow to confirm that it is returning only one row (it should based on ROWNUM = 1)?&lt;BR /&gt;In your tMap  did you drag a field from the main flow onto the primary key of the lookup row to enforce a match?  Also, did you specify the tMap join type to inner join?&lt;BR /&gt;Thanks,&lt;BR /&gt;Ben</description>
      <pubDate>Fri, 25 May 2012 18:05:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-get-random-value-from-a-colum-on-a-table-for-each-row/m-p/2300776#M72969</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-25T18:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to get random value from a colum on a table for each row?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-get-random-value-from-a-colum-on-a-table-for-each-row/m-p/2300777#M72970</link>
      <description>Hi Ben, 
&lt;BR /&gt;Thanks for the welcome and reply. 
&lt;BR /&gt;The query does work, the query of the first post was to show the idea of how I get a random row, this is the exact query: 
&lt;BR /&gt;"SELECT * 
&lt;BR /&gt;FROM "+context.SGAE_Schema+".DEPARTAMENTOS 
&lt;BR /&gt;WHERE "+context.SGAE_Schema+".DEPARTAMENTOS.CODIGO IN ( 
&lt;BR /&gt; SELECT "+context.SGAE_Schema+".DEPARTAMENTOS.CODIGO 
&lt;BR /&gt; FROM (SELECT "+context.SGAE_Schema+".DEPARTAMENTOS.CODIGO, 
&lt;BR /&gt; SYS.DBMS_RANDOM.RANDOM 
&lt;BR /&gt; FROM "+context.SGAE_Schema+".DEPARTAMENTOS ORDER BY 2) 
&lt;BR /&gt; WHERE rownum &amp;lt;= 10 ) 
&lt;BR /&gt;AND rownum = 1" 
&lt;BR /&gt;I tried it and it works, but when using it in a TMap returns all rows in the table and combines them with the main flow. 
&lt;BR /&gt;I can not join, no attribute in common. 
&lt;BR /&gt;What I want is a random code from the DEPARTMENTOS table to combine with other values of the main flow. 
&lt;BR /&gt;The idea was to use this consultation to function as working with oracle sequences, that by choosing to "reload at Each road" brings the next sequence value for each row, I believed that using this option execute the query once each row as it seemed to a sequence, but this is not so. 
&lt;BR /&gt;I do not know if I'm clear, I will try to put some screenshots if not understood. 
&lt;BR /&gt;Sorry for my English 
&lt;BR /&gt;regards 
&lt;BR /&gt;thanks</description>
      <pubDate>Fri, 25 May 2012 21:39:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-get-random-value-from-a-colum-on-a-table-for-each-row/m-p/2300777#M72970</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-25T21:39:13Z</dc:date>
    </item>
  </channel>
</rss>

