<?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 tDBInput query calling stored procedure with parameter from globalMap in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/tDBInput-query-calling-stored-procedure-with-parameter-from/m-p/2341926#M109840</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used a tDBInput as a lookup query for a tMap.&lt;/P&gt;&lt;P&gt;tDBInput connects to a SQL Server via tDBConnection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The query in tDBInput has to call a stored procedure with one string parameter. This works when I hardcode the parameter value. It doesn't work when I replace it with a reference to a global variable I set through tSetGlobalVar. There's no error, but I see no rows come back. When I use a SQL Profiler I see that the stored procedure is executed, but with an empty parameter string. So I'm not sure what happens...I suppose executing the query is not one of the first things TOS does, before I assign the value to the global variables in tJavaFlex1?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the hardcoded version that works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;"exec proc_EDA_prd_fuji_GetPanelLayout '13341201';"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the query I want to use that doesn't work (no error, just no result):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;"exec proc_EDA_prd_fuji_GetPanelLayout '" + ((String)globalMap.get("inHeader_SerialNo_stripped")) + "';"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000bGkA2AAK.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/151002i5295AA9C6E9902AB/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000bGkA2AAK.jpg" alt="0695b00000bGkA2AAK.jpg" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to TOS so probably I'm missing something obvious here...&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Fri, 15 Nov 2024 22:12:21 GMT</pubDate>
    <dc:creator>BartG</dc:creator>
    <dc:date>2024-11-15T22:12:21Z</dc:date>
    <item>
      <title>tDBInput query calling stored procedure with parameter from globalMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tDBInput-query-calling-stored-procedure-with-parameter-from/m-p/2341926#M109840</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used a tDBInput as a lookup query for a tMap.&lt;/P&gt;&lt;P&gt;tDBInput connects to a SQL Server via tDBConnection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The query in tDBInput has to call a stored procedure with one string parameter. This works when I hardcode the parameter value. It doesn't work when I replace it with a reference to a global variable I set through tSetGlobalVar. There's no error, but I see no rows come back. When I use a SQL Profiler I see that the stored procedure is executed, but with an empty parameter string. So I'm not sure what happens...I suppose executing the query is not one of the first things TOS does, before I assign the value to the global variables in tJavaFlex1?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the hardcoded version that works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;"exec proc_EDA_prd_fuji_GetPanelLayout '13341201';"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the query I want to use that doesn't work (no error, just no result):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;"exec proc_EDA_prd_fuji_GetPanelLayout '" + ((String)globalMap.get("inHeader_SerialNo_stripped")) + "';"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000bGkA2AAK.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/151002i5295AA9C6E9902AB/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000bGkA2AAK.jpg" alt="0695b00000bGkA2AAK.jpg" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to TOS so probably I'm missing something obvious here...&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 22:12:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tDBInput-query-calling-stored-procedure-with-parameter-from/m-p/2341926#M109840</guid>
      <dc:creator>BartG</dc:creator>
      <dc:date>2024-11-15T22:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: tDBInput query calling stored procedure with parameter from globalMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tDBInput-query-calling-stored-procedure-with-parameter-from/m-p/2341927#M109841</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;As this component is generally used as a one-component subJob, please use OnsubjobOk connection type to trigger your main job.&lt;/P&gt;&lt;P&gt;tSetGlobalVar--&amp;gt;onsubjobok--&amp;gt;tDBconnection&lt;/P&gt;&lt;P&gt; |&lt;/P&gt;&lt;P&gt; OnsubjobOK&lt;/P&gt;&lt;P&gt; | &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;twaitforfile--&amp;gt;tfileinputfullrow--&amp;gt;tjavaflex--.tjavarow--&amp;gt;tmap--&amp;gt;tjavaflex&lt;/P&gt;&lt;P&gt;&amp;nbsp;                                                                                     (Look up tdbinput)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Sabrina&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 04:24:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tDBInput-query-calling-stored-procedure-with-parameter-from/m-p/2341927#M109841</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-12T04:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: tDBInput query calling stored procedure with parameter from globalMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tDBInput-query-calling-stored-procedure-with-parameter-from/m-p/2341928#M109842</link>
      <description>&lt;P&gt;In this tutorial topic we will cover how to create SQL Server stored procedures that use input parameters. &lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 05:53:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tDBInput-query-calling-stored-procedure-with-parameter-from/m-p/2341928#M109842</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-12T05:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: tDBInput query calling stored procedure with parameter from globalMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tDBInput-query-calling-stored-procedure-with-parameter-from/m-p/2341929#M109843</link>
      <description>&lt;P&gt;Hi, in what tutorial topic?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 10:50:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tDBInput-query-calling-stored-procedure-with-parameter-from/m-p/2341929#M109843</guid>
      <dc:creator>BartG</dc:creator>
      <dc:date>2023-01-12T10:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: tDBInput query calling stored procedure with parameter from globalMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tDBInput-query-calling-stored-procedure-with-parameter-from/m-p/2341930#M109844</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm sorry but I don't understand how I should connect everything based on your feedback &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;If I connect tSetGlobalVar --&amp;gt; tDBConnection --&amp;gt; tDBInput, I can't seem to connect tDBInput to tMap anymore to use it as a lookup?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000bGyNKAA0.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/128949i37B0EBF110ED2F3E/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000bGyNKAA0.jpg" alt="0695b00000bGyNKAA0.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 10:55:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tDBInput-query-calling-stored-procedure-with-parameter-from/m-p/2341930#M109844</guid>
      <dc:creator>BartG</dc:creator>
      <dc:date>2023-01-12T10:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: tDBInput query calling stored procedure with parameter from globalMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tDBInput-query-calling-stored-procedure-with-parameter-from/m-p/2341931#M109845</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;Please connect  tSetGlobalVar --&amp;gt; tDBConnection and then trigger your main job.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000bHFW9AAO.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/135185i64281AA4937BE5AF/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000bHFW9AAO.png" alt="0695b00000bHFW9AAO.png" /&gt;&lt;/span&gt;Best regards&lt;/P&gt;&lt;P&gt;Sabrina&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 08:39:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tDBInput-query-calling-stored-procedure-with-parameter-from/m-p/2341931#M109845</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-13T08:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: tDBInput query calling stored procedure with parameter from globalMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tDBInput-query-calling-stored-procedure-with-parameter-from/m-p/2341932#M109846</link>
      <description>&lt;P&gt;Hi Sabrina,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, I misunderstood. I now used your suggestion, but it still looks like the variable that is given to the stored procedure parameter is empty.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like I said earlier: the variable is globalMap.get("inHeader_SerialNo_stripped") is being set in step "tJavaFlex1". I think the 5th line in the file contains a serial number that I need to pass to tDBInput as a parameter. So the variable "inHeader_SerialNo_stripped" will only be filled somewhere after processing a few lines of the input file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I make sure tDBInput is only executed when "inHeader_SerialNo_stripped" is filled?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In fact, the flow could check for variable "inHeader_SerialNo_stripped" to be filled in tJavaFlex_1 and only pass through the lines once the variable is filled. The input file contains some header lines first that I need to process, but those lines are not necessary for tJavaRow_1 and what follows. So I need some kind of condition that can decide whether the flow can continue or not, per line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll describe my input file a bit, I hope it makes things more clear...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;@B&lt;/P&gt;&lt;P&gt;* PASS *&lt;/P&gt;&lt;P&gt;Model:Bottom PAN.SWX2&lt;/P&gt;&lt;P&gt;Serial No.:13341201&lt;/P&gt;&lt;P&gt;DATE 15/11/2022 10:19:44&lt;/P&gt;&lt;P&gt;Test time:54 s&lt;/P&gt;&lt;P&gt;Test ID :8000&lt;/P&gt;&lt;P&gt;Index :TV007&lt;/P&gt;&lt;P&gt;@&lt;/P&gt;&lt;P&gt;01 "13341201" 000001 "IG1P1&amp;nbsp;&amp;nbsp;&amp;nbsp;" "PASS&amp;nbsp;&amp;nbsp;" "P-Auto&amp;nbsp;&amp;nbsp;&amp;nbsp;" 400 409.5 0 +50% -50%&lt;/P&gt;&lt;P&gt;01 "13341201" 000002 "C9*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;" "PASS&amp;nbsp;&amp;nbsp;" "1.2uF&amp;nbsp;&amp;nbsp;&amp;nbsp;" 1.1E-6 1.084E-6 0 +15% -15%&lt;/P&gt;&lt;P&gt;01 "13341201" 000003 "IG1P3&amp;nbsp;&amp;nbsp;&amp;nbsp;" "PASS&amp;nbsp;&amp;nbsp;" "P-Auto&amp;nbsp;&amp;nbsp;&amp;nbsp;" 400 202.8 0 +50% -50%&lt;/P&gt;&lt;P&gt;01 "13341201" 000004 "C10*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;" "PASS&amp;nbsp;&amp;nbsp;" "440.47uF&amp;nbsp;&amp;nbsp;" 0.00044 0.000423 0 +20% -20%&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;@E&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So between "@B" and "@" are the header lines. Between "@" and "@E" are the body lines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use tJavaFlex_1 to parse the contents of the lines one by one, to see whether we're in the header or the body. When we're in the header, I fill some variables in my tSetGlobalVar_1 to use later on when writing my output files (tJavaFlex_5).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One of the variables in the header is "Serial No." as you can see. This is the variable I need to pass to tDBInput_1 to execute the stored procedure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So tJavaFlex_1 makes sure the header lines go to tSetGlobalVar_1 to be used later on, and the body lines go further through the flow to tJavaRow_1 etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000bHGMAAA4.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/143529i73C963ABBE5B2C3B/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000bHGMAAA4.jpg" alt="0695b00000bHGMAAA4.jpg" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 12:42:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tDBInput-query-calling-stored-procedure-with-parameter-from/m-p/2341932#M109846</guid>
      <dc:creator>BartG</dc:creator>
      <dc:date>2023-01-13T12:42:49Z</dc:date>
    </item>
  </channel>
</rss>

