<?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 Load User Defined Function from Script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Load-User-Defined-Function-from-Script/m-p/1285691#M402539</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a user defined function called GetPayLoad, which I defined in Tools -&amp;gt; Edit Module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function GetPayLoad(jsonString, fieldName) {&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (jsonString) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; var json = eval('('+jsonString+')');&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (json.hasOwnProperty(fieldName)) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; return json[fieldName];&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; return null;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;It works as expected. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Now I would like to export it to a text file so that I can reuse it in other applications. Therefore I exported the function to a txt file, inserted an include command in the script and tried to use the function during load.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;RemoteTable:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ad_uuid,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GetPayLoad(payload_json, 'fromMail') AS fromMail;&lt;/P&gt;&lt;P&gt;SQL SELECT &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ad_uuid,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; toJson(payload) AS payload_json&lt;/P&gt;&lt;P&gt;FROM ...&lt;SPAN style="font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Now I get the error &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Unknown statement&lt;/P&gt;&lt;P&gt;function GetPayLoad(jsonString, fieldName) {&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (jsonString) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; var json = eval('('+jsonString+')')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me with that? Do I need to call the function separately somehow?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks! Nihal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Mar 2017 13:16:24 GMT</pubDate>
    <dc:creator>nigel987</dc:creator>
    <dc:date>2017-03-14T13:16:24Z</dc:date>
    <item>
      <title>Load User Defined Function from Script</title>
      <link>https://community.qlik.com/t5/QlikView/Load-User-Defined-Function-from-Script/m-p/1285691#M402539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a user defined function called GetPayLoad, which I defined in Tools -&amp;gt; Edit Module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function GetPayLoad(jsonString, fieldName) {&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (jsonString) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; var json = eval('('+jsonString+')');&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (json.hasOwnProperty(fieldName)) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; return json[fieldName];&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; return null;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;It works as expected. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Now I would like to export it to a text file so that I can reuse it in other applications. Therefore I exported the function to a txt file, inserted an include command in the script and tried to use the function during load.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;RemoteTable:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ad_uuid,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GetPayLoad(payload_json, 'fromMail') AS fromMail;&lt;/P&gt;&lt;P&gt;SQL SELECT &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ad_uuid,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; toJson(payload) AS payload_json&lt;/P&gt;&lt;P&gt;FROM ...&lt;SPAN style="font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Now I get the error &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Unknown statement&lt;/P&gt;&lt;P&gt;function GetPayLoad(jsonString, fieldName) {&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (jsonString) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; var json = eval('('+jsonString+')')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me with that? Do I need to call the function separately somehow?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks! Nihal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Mar 2017 13:16:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-User-Defined-Function-from-Script/m-p/1285691#M402539</guid>
      <dc:creator>nigel987</dc:creator>
      <dc:date>2017-03-14T13:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: Load User Defined Function from Script</title>
      <link>https://community.qlik.com/t5/QlikView/Load-User-Defined-Function-from-Script/m-p/1285692#M402540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As per my knowledge the &lt;STRONG&gt;Macro code has to be in the Macro edit window &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Qlikview edit script has the ability to call the function but you cannot have the macro code in the QV edit script &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paste the code in the macro editor and then try &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Mar 2017 13:38:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-User-Defined-Function-from-Script/m-p/1285692#M402540</guid>
      <dc:creator>avinashelite</dc:creator>
      <dc:date>2017-03-14T13:38:07Z</dc:date>
    </item>
  </channel>
</rss>

