<?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 use SQL function and where to put it? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363881#M127705</link>
    <description>falashock,&lt;BR /&gt;The query to create the function u would have to put in a tMysqlRow. &lt;BR /&gt;I think if u want to call the function in a select statement to get the "translatedIdTheme" value, you would have to use the TmsysqlInput.&lt;BR /&gt;But i'm assuming you have tried this?&lt;BR /&gt;Regards</description>
    <pubDate>Thu, 29 Sep 2011 12:08:54 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2011-09-29T12:08:54Z</dc:date>
    <item>
      <title>How to use SQL function and where to put it?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363876#M127700</link>
      <description>Hi everyone,&lt;BR /&gt;Could you tell me how to apply/use a SQL function created and saved under a sql file (file.sql) in Talend? &lt;BR /&gt;I am not sure if I make myself clear. I actually want to use a SQL function in tMysql_Input component. How can I do that?&lt;BR /&gt;Thanks before hand.</description>
      <pubDate>Sat, 16 Nov 2024 12:39:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363876#M127700</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T12:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL function and where to put it?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363877#M127701</link>
      <description>Hi 
&lt;BR /&gt;Do you want to call a function or use a function in the query? What does your query looks like?
&lt;BR /&gt;Best regards
&lt;BR /&gt;Shong</description>
      <pubDate>Thu, 29 Sep 2011 06:28:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363877#M127701</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-29T06:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL function and where to put it?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363878#M127702</link>
      <description>Hi,
&lt;BR /&gt;Here is my function save in a .sql file :
&lt;BR /&gt;set global log_bin_trust_function_creators=TRUE;
&lt;BR /&gt;DROP FUNCTION IF EXISTS function1;
&lt;BR /&gt;DELIMITER |
&lt;BR /&gt;CREATE FUNCTION function1( codeTif1 INTEGER, codeTif2 INTEGER, codeTif3 INTEGER) RETURNS float
&lt;BR /&gt;BEGIN 
&lt;BR /&gt; DECLARE translatedIdTheme INTEGER;
&lt;BR /&gt; DECLARE classicIdTheme INTEGER;
&lt;BR /&gt; SELECT th.idTheme 
&lt;BR /&gt; INTO translatedIdTheme 
&lt;BR /&gt; FROM mt_theme AS th, mt_repository_mapping AS rm
&lt;BR /&gt; WHERE rm.codeConstellation = codeTif6
&lt;BR /&gt; AND th.codeTif1 = rm.mobi1
&lt;BR /&gt; AND th.codeTif2 = rm.mobi2
&lt;BR /&gt; AND th.codeTif3 = rm.mobi3
&lt;BR /&gt; LIMIT 1;
&lt;BR /&gt; RETURN translatedIdTheme;
&lt;BR /&gt; END;
&lt;BR /&gt;|
&lt;BR /&gt;DELIMITER ;
&lt;BR /&gt;
&lt;BR /&gt;and I want to use it in my Talend job, where it is called by a component tMysqlInput in the query section . When I launch the job, the function is unknown and I don't know how to call/initialize/load it into my job.
&lt;BR /&gt;Thanks in advance</description>
      <pubDate>Thu, 29 Sep 2011 09:09:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363878#M127702</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-29T09:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL function and where to put it?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363879#M127703</link>
      <description>Hi,&lt;BR /&gt;This will only create the function right and not execute the select statement?&lt;BR /&gt;If so I would say you have to use the tMysqlRow component and put your query in there.&lt;BR /&gt;Regards,&lt;BR /&gt;Mario De Pauw</description>
      <pubDate>Thu, 29 Sep 2011 10:49:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363879#M127703</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-29T10:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL function and where to put it?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363880#M127704</link>
      <description>Hello mpa! &lt;BR /&gt;Thanks for your reply. Well, as I mentioned earlier. The function is called in tMysqlInput as it needs to use that function the treat some data. &lt;BR /&gt;When you suggested me to use tMysqlRow and put the query in there, u mean the sql query that belong to the function1 in sql file? or the sql query that calls the function?&lt;BR /&gt;Regards,</description>
      <pubDate>Thu, 29 Sep 2011 11:50:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363880#M127704</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-29T11:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL function and where to put it?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363881#M127705</link>
      <description>falashock,&lt;BR /&gt;The query to create the function u would have to put in a tMysqlRow. &lt;BR /&gt;I think if u want to call the function in a select statement to get the "translatedIdTheme" value, you would have to use the TmsysqlInput.&lt;BR /&gt;But i'm assuming you have tried this?&lt;BR /&gt;Regards</description>
      <pubDate>Thu, 29 Sep 2011 12:08:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363881#M127705</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-29T12:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL function and where to put it?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363882#M127706</link>
      <description>Well, just to make sure, here is a screenshot of my job. 
&lt;BR /&gt;As you can see, in tMysqlInput, there is a SQL query that calls the function TranslateTheme, which is currently written in a .sql file. 
&lt;BR /&gt;I am sorry, I still can't figure out how to put that .sql file into my job. 
&lt;BR /&gt; 
&lt;IMG src="https://community.qlik.com/" /&gt; 
&lt;BR /&gt;Thanks in advance.</description>
      <pubDate>Thu, 29 Sep 2011 14:34:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363882#M127706</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-29T14:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL function and where to put it?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363883#M127707</link>
      <description>Falashock,
&lt;BR /&gt;Put your SQL query into a Tmysqlrow. Connect that component between tMysqlconnection and tFileList_1. 
&lt;BR /&gt;set global log_bin_trust_function_creators=TRUE;
&lt;BR /&gt;DROP FUNCTION IF EXISTS function1;
&lt;BR /&gt;DELIMITER |
&lt;BR /&gt;CREATE FUNCTION function1( codeTif1 INTEGER, codeTif2 INTEGER, codeTif3 INTEGER) RETURNS float
&lt;BR /&gt;BEGIN
&lt;BR /&gt; DECLARE translatedIdTheme INTEGER;
&lt;BR /&gt; DECLARE classicIdTheme INTEGER;
&lt;BR /&gt; SELECT th.idTheme
&lt;BR /&gt; INTO translatedIdTheme
&lt;BR /&gt; FROM mt_theme AS th, mt_repository_mapping AS rm
&lt;BR /&gt; WHERE rm.codeConstellation = codeTif6
&lt;BR /&gt; AND th.codeTif1 = rm.mobi1
&lt;BR /&gt; AND th.codeTif2 = rm.mobi2
&lt;BR /&gt; AND th.codeTif3 = rm.mobi3
&lt;BR /&gt; LIMIT 1;
&lt;BR /&gt; RETURN translatedIdTheme;
&lt;BR /&gt; END;
&lt;BR /&gt;|
&lt;BR /&gt;DELIMITER ;
&lt;BR /&gt;
&lt;BR /&gt;regards</description>
      <pubDate>Thu, 29 Sep 2011 14:39:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363883#M127707</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-29T14:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL function and where to put it?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363884#M127708</link>
      <description>Thanks mpa, I will try that out. I will keep you posted.</description>
      <pubDate>Fri, 30 Sep 2011 08:40:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363884#M127708</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-30T08:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL function and where to put it?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363885#M127709</link>
      <description>I am back.... with bad news -_- 
&lt;BR /&gt;Well, I still got the error that my function does not exist or with a lot of errors in SQL syntax. The colleague that left me the job and the code told me that the SQL is correct as it has been used many times already. 
&lt;BR /&gt;Did I do something wrong? 
&lt;BR /&gt; 
&lt;IMG src="https://community.qlik.com/" /&gt; 
&lt;BR /&gt;Here is the function .sql 
&lt;BR /&gt;---- 
&lt;BR /&gt;set global log_bin_trust_function_creators=TRUE; 
&lt;BR /&gt;DROP FUNCTION IF EXISTS translateTheme; 
&lt;BR /&gt;DELIMITER | 
&lt;BR /&gt;CREATE FUNCTION translateTheme( codeTif1 INTEGER, codeTif2 INTEGER, codeTif3 INTEGER, codeTif4 INTEGER, codeTif5 INTEGER, codeTif6 VARCHAR(36)) RETURNS float 
&lt;BR /&gt;BEGIN 
&lt;BR /&gt; DECLARE translatedIdTheme INTEGER; 
&lt;BR /&gt; DECLARE classicIdTheme INTEGER; 
&lt;BR /&gt; IF CHAR_LENGTH( codeTif6 ) = 36 THEN 
&lt;BR /&gt; SELECT th.idTheme 
&lt;BR /&gt; INTO translatedIdTheme 
&lt;BR /&gt; FROM mt_theme AS th, mt_repository_mapping AS rm 
&lt;BR /&gt; WHERE rm.codeConstellation = codeTif6 
&lt;BR /&gt; AND th.codeTif1 = rm.mobi1 
&lt;BR /&gt; AND th.codeTif2 = rm.mobi2 
&lt;BR /&gt; AND th.codeTif3 = rm.mobi3 
&lt;BR /&gt; AND th.codeTif4 = rm.mobi4 
&lt;BR /&gt; AND th.codeTif5 = rm.mobi5 
&lt;BR /&gt; AND th.codeTif6 = rm.mobi6 
&lt;BR /&gt; LIMIT 1; 
&lt;BR /&gt; RETURN translatedIdTheme; 
&lt;BR /&gt; ELSE 
&lt;BR /&gt; SELECT th.idTheme 
&lt;BR /&gt; INTO translatedIdTheme 
&lt;BR /&gt; FROM mt_theme AS th, mt_repository_mapping AS rm 
&lt;BR /&gt; WHERE rm.constellation1 = codeTif1 
&lt;BR /&gt; AND rm.constellation2 = codeTif2 
&lt;BR /&gt; AND rm.constellation3 = codeTif3 
&lt;BR /&gt; AND rm.constellation4 = codeTif4 
&lt;BR /&gt; AND rm.constellation5 = codeTif5 
&lt;BR /&gt; AND rm.constellation6 = CAST(codeTif6 AS SIGNED) 
&lt;BR /&gt; AND th.codeTif1 = rm.mobi1 
&lt;BR /&gt; AND th.codeTif2 = rm.mobi2 
&lt;BR /&gt; AND th.codeTif3 = rm.mobi3 
&lt;BR /&gt; AND th.codeTif4 = rm.mobi4 
&lt;BR /&gt; AND th.codeTif5 = rm.mobi5 
&lt;BR /&gt; AND th.codeTif6 = rm.mobi6 
&lt;BR /&gt; LIMIT 1; 
&lt;BR /&gt; SELECT th.idTheme 
&lt;BR /&gt; INTO classicIdTheme 
&lt;BR /&gt; FROM mt_theme AS th 
&lt;BR /&gt; WHERE th.codeTif1 = codeTif1 
&lt;BR /&gt; AND th.codeTif2 = codeTif2 
&lt;BR /&gt; AND th.codeTif3 = codeTif3 
&lt;BR /&gt; AND th.codeTif4 = codeTif4 
&lt;BR /&gt; AND th.codeTif5 = codeTif5 
&lt;BR /&gt; AND th.codeTif6 = CAST(codeTif6 AS SIGNED) 
&lt;BR /&gt; LIMIT 1; 
&lt;BR /&gt; RETURN IFNULL(translatedIdTheme, classicIdTheme); 
&lt;BR /&gt; END IF; 
&lt;BR /&gt;END; 
&lt;BR /&gt;| 
&lt;BR /&gt;DELIMITER ;</description>
      <pubDate>Fri, 30 Sep 2011 09:25:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363885#M127709</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-30T09:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL function and where to put it?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363886#M127710</link>
      <description>Why don't you just create this function in the database?</description>
      <pubDate>Fri, 30 Sep 2011 09:43:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363886#M127710</guid>
      <dc:creator>janhess</dc:creator>
      <dc:date>2011-09-30T09:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL function and where to put it?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363887#M127711</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;Why don't you just create this function in the database?&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;Can you tell me how? 
&lt;BR /&gt;Here is what I try : 
&lt;BR /&gt;Metadeta-&amp;gt;Db Connections-&amp;gt;DemoMysql 0.1-&amp;gt;Queries? 
&lt;BR /&gt; 
&lt;IMG src="https://community.qlik.com/" /&gt;</description>
      <pubDate>Fri, 30 Sep 2011 11:46:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363887#M127711</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-30T11:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL function and where to put it?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363888#M127712</link>
      <description>I am back. 
&lt;BR /&gt;Everything works now. Thanks alot everyone, shong, mpa and janhess.</description>
      <pubDate>Fri, 30 Sep 2011 14:18:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363888#M127712</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-30T14:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL function and where to put it?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363889#M127713</link>
      <description>How did you resolve it?</description>
      <pubDate>Fri, 30 Sep 2011 14:27:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363889#M127713</guid>
      <dc:creator>janhess</dc:creator>
      <dc:date>2011-09-30T14:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL function and where to put it?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363890#M127714</link>
      <description>I followed what mpa suggested and debugged the SQL function itself. 
&lt;BR /&gt;Copy-past the function in the SQL query section of Tmysqlrow did not work. I had to quote the whole function code, making it look like one big long string. 
&lt;BR /&gt;I am not sure if I made myself clear 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Fri, 30 Sep 2011 14:37:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363890#M127714</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-30T14:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL function and where to put it?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363891#M127715</link>
      <description>You have to do that with all SQL in Talend</description>
      <pubDate>Fri, 30 Sep 2011 16:44:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363891#M127715</guid>
      <dc:creator>janhess</dc:creator>
      <dc:date>2011-09-30T16:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SQL function and where to put it?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363892#M127716</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;You have to do that with all SQL in Talend&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;Yep. Just figured that out. I am new to Talend. It's been like a week that I use it 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Fri, 30 Sep 2011 16:50:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-SQL-function-and-where-to-put-it/m-p/2363892#M127716</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-30T16:50:58Z</dc:date>
    </item>
  </channel>
</rss>

