<?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: From macro to script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/From-macro-to-script/m-p/1790064#M1210514</link>
    <description>&lt;P&gt;Please add some sample and expected output. That helps in faster response.&lt;/P&gt;</description>
    <pubDate>Wed, 10 Mar 2021 13:58:54 GMT</pubDate>
    <dc:creator>Saravanan_Desingh</dc:creator>
    <dc:date>2021-03-10T13:58:54Z</dc:date>
    <item>
      <title>From macro to script</title>
      <link>https://community.qlik.com/t5/QlikView/From-macro-to-script/m-p/1790004#M1210509</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I have just finished a macro and it works. For some purposes I want to write this macro in the script. I tried it, but it did not work.&lt;/P&gt;&lt;P&gt;Here is the code of the function:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;function test(a,b,c,g,delta_g,e,f)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;delta=(b-a)/c&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;t=a+delta&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;do while t=&amp;lt;b&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;v_i=v_i+(d(t-delta)+d(t)-w(t-delta)-w(t))*(delta/2)/(g+delta_g)&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;v_ii=v_ii+(d(t+delta)+d(t)-w(t+delta)-w(t))*(delta/2)/(g+delta_g)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;p_i=v_i*d(t)&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;p_ii=v_ii*d(t+delta)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;if p_i&amp;gt;0 and p_ii&amp;gt;0 then&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;final=final+(p_i+p_ii)*(delta/2)/f&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;else&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;final=final+(p_i+p_ii)*(delta/2)*fend if&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;t=t+delta&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;loop&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;test=final-e&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;end function&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where w() and d() are predefined functions.&lt;/P&gt;&lt;P&gt;What should the equivalent look like in the script?&lt;BR /&gt;&lt;BR /&gt;Any help please?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 12:09:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/From-macro-to-script/m-p/1790004#M1210509</guid>
      <dc:creator>AmCh</dc:creator>
      <dc:date>2021-03-10T12:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: From macro to script</title>
      <link>https://community.qlik.com/t5/QlikView/From-macro-to-script/m-p/1790041#M1210511</link>
      <description>&lt;P&gt;i suspect the reason you want to move this to your load script is you have a table of fields equivalent to a,b,c,g,f, etc and you want to call the function for each row.&amp;nbsp; you can do a loop through your table and call your function (it is SUB routine in load script) this way your code is cleaner and you reuse a proven function:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptControlStatements/Sub.htm" target="_blank"&gt;Sub..end sub ‒ QlikView&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 13:18:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/From-macro-to-script/m-p/1790041#M1210511</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2021-03-10T13:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: From macro to script</title>
      <link>https://community.qlik.com/t5/QlikView/From-macro-to-script/m-p/1790064#M1210514</link>
      <description>&lt;P&gt;Please add some sample and expected output. That helps in faster response.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 13:58:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/From-macro-to-script/m-p/1790064#M1210514</guid>
      <dc:creator>Saravanan_Desingh</dc:creator>
      <dc:date>2021-03-10T13:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: From macro to script</title>
      <link>https://community.qlik.com/t5/QlikView/From-macro-to-script/m-p/1790065#M1210515</link>
      <description>&lt;P&gt;No, &lt;STRONG&gt;a,b,c&lt;/STRONG&gt; etc are not fields of table. They have a unique values.&lt;/P&gt;&lt;P&gt;There is an 1:1 equivalent?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 14:01:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/From-macro-to-script/m-p/1790065#M1210515</guid>
      <dc:creator>AmCh</dc:creator>
      <dc:date>2021-03-10T14:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: From macro to script</title>
      <link>https://community.qlik.com/t5/QlikView/From-macro-to-script/m-p/1790508#M1210584</link>
      <description>&lt;P&gt;this is the same question:&lt;BR /&gt;&lt;A href="https://community.qlik.com/t5/QlikView-App-Dev/Field-generation-within-while-loop/m-p/1790273#M1210548" target="_blank"&gt;Re: Field generation within while loop - Qlik Community - 1789989&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 13:09:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/From-macro-to-script/m-p/1790508#M1210584</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2021-03-11T13:09:47Z</dc:date>
    </item>
  </channel>
</rss>

