<?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: Database query result (Dates) set to context variable or better choices? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Database-query-result-Dates-set-to-context-variable-or-better/m-p/2275278#M51707</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;You can do this way also as long as you are maintaining the format of the date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Warm Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nikhil Thampi&lt;/P&gt;</description>
    <pubDate>Tue, 23 Oct 2018 18:44:41 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-10-23T18:44:41Z</dc:date>
    <item>
      <title>Database query result (Dates) set to context variable or better choices?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Database-query-result-Dates-set-to-context-variable-or-better/m-p/2275275#M51704</link>
      <description>&lt;P&gt;&lt;FONT color="#0000FF"&gt;I'd like to output the result from a SQL query into something like a context variable so it can be used later in the job. &lt;/FONT&gt;&lt;/P&gt; 
&lt;P&gt;I have done this before with the output as string.&lt;/P&gt; 
&lt;P&gt;tDBInput---------&amp;gt; tSetGlobalVar&lt;/P&gt; 
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;But this time, the query output would be two dates:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt; 
&lt;P&gt;"StartDate" and "EndDate".&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Then I will use these two dates in another sql query to check an distinct count.&lt;/P&gt; 
&lt;P&gt;The SQL would be something like:&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;select count(distinct Order_Date) as cnt from tablename where Order_Date between&amp;nbsp;&lt;SPAN&gt;"StartDate" and "EndDate".&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;Again, the job will be :&amp;nbsp;&amp;nbsp;tDBInput---------&amp;gt; tSetGlobalVar , this time the count(cnt) will be the global variable.&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;My question is:&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;1. Am I doing things correctly here?&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;2. If I am, how should I refer these&amp;nbsp;"StartDate" and "EndDate" in my 2nd query?&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>Mon, 22 Oct 2018 22:11:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Database-query-result-Dates-set-to-context-variable-or-better/m-p/2275275#M51704</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-22T22:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: Database query result (Dates) set to context variable or better choices?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Database-query-result-Dates-set-to-context-variable-or-better/m-p/2275276#M51705</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp; &amp;nbsp; You can use either tSetGlobalVar or tjavarow to set the data coming out from predecessor component to a context variable.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;My understanding is that you are looking for delta data processing and it is the right methodology.&amp;nbsp;Some minor changes can help you to achieve the results.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;a) Fetch the start date and end date data as string in specified format or convert the data to string&lt;/P&gt; 
&lt;P&gt;b) Use a to_date function to convert the string back to date&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Please also refer the below post which is doing similar activity.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;A href="https://community.qlik.com/s/feed/0D73p000004kVfnCAE#M85679" target="_blank"&gt;https://community.talend.com/t5/Design-and-Development/ORA-00933-in-tDBRow-when-using-context-variable/m-p/137861#M85679&lt;/A&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Could you please mark the topic as resolved if my answer has helped you? Kudos are also welcome &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Warm Regards,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Nikhil Thampi&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 05:06:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Database-query-result-Dates-set-to-context-variable-or-better/m-p/2275276#M51705</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-23T05:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: Database query result (Dates) set to context variable or better choices?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Database-query-result-Dates-set-to-context-variable-or-better/m-p/2275277#M51706</link>
      <description>&lt;P&gt;&lt;FONT color="#FF0000"&gt;a) Fetch the start date and end date data as string in specified format or convert the data to string&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Should I convert the start_date and end_date into string in my SQL?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Can I output these two as Date first and convert them into string with Talend component? I would prefer this if this could be done.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;b) Use a to_date function to convert the string back to date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 17:55:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Database-query-result-Dates-set-to-context-variable-or-better/m-p/2275277#M51706</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-23T17:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: Database query result (Dates) set to context variable or better choices?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Database-query-result-Dates-set-to-context-variable-or-better/m-p/2275278#M51707</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;You can do this way also as long as you are maintaining the format of the date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Warm Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nikhil Thampi&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 18:44:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Database-query-result-Dates-set-to-context-variable-or-better/m-p/2275278#M51707</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-23T18:44:41Z</dc:date>
    </item>
  </channel>
</rss>

