<?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: Code reusability in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Code-reusability/m-p/535570#M1126511</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Maybe user defined functions can help you here. These are defined as variables in the QlikView script, e.g.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;set&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Verdana; font-size: medium;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #808080; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;&lt;EM&gt;vDiffMonths&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Verdana; font-size: medium;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 9pt; font-family: 'Courier New';"&gt;= Round(interval(date($2) - date($1)) / 30);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;set&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Verdana; font-size: medium;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #808080; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;&lt;EM&gt;vDiffQuarters&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Verdana; font-size: medium;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 9pt; font-family: 'Courier New';"&gt;= Round(interval(date($2) - date($1)) / 90);&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;set&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Verdana; font-size: medium;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #808080; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;&lt;EM&gt;vDiffMonths2&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Verdana; font-size: medium;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 9pt; font-family: 'Courier New';"&gt;= ((YEAR(date($2))-YEAR(date($1)))*12)+(MONTH(date($2))-MONTH(date($1)));&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;set&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Verdana; font-size: medium;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #808080; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;&lt;EM&gt;vDiffQuarters2&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Verdana; font-size: medium;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 9pt; font-family: 'Courier New';"&gt;= ((YEAR(date($2))-YEAR(date($1)))*3)+(ceil(Month(date($2))/3)-ceil(Month(date($2))/3)); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;You would then reference the function like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #808080; font-size: 12px; font-family: Arial;"&gt;&lt;STRONG&gt;&lt;EM&gt;$(vDiffMonths('12/04/2011','05/02/2012'))&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="; color: #000000; font-size: 9pt; font-family: arial, helvetica, sans-serif;"&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;You can also store them in an Excel spreadsheet that can be imported into the QVW. This makes the functions easy to manage. See the solution that &lt;/SPAN&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;A href="https://community.qlik.com/qlik-users/126128"&gt;Karl Pover&lt;/A&gt; recommends here: &lt;A _jive_internal="true" href="https://community.qlik.com/message/89749"&gt;http://community.qlik.com/message/89749&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #808080; font-family: Arial; font-size: 12px;"&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Dec 2013 11:39:26 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-12-30T11:39:26Z</dc:date>
    <item>
      <title>Code reusability</title>
      <link>https://community.qlik.com/t5/QlikView/Code-reusability/m-p/535567#M1126508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i need to calculated business hours for many date fields. there are mutiple lines of code for the same to calculate.&lt;/P&gt;&lt;P&gt;Can any one suggest how to reuse the same lines of code many times for different date fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Grace&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Dec 2013 11:30:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Code-reusability/m-p/535567#M1126508</guid>
      <dc:creator>rash_611</dc:creator>
      <dc:date>2013-12-30T11:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Code reusability</title>
      <link>https://community.qlik.com/t5/QlikView/Code-reusability/m-p/535568#M1126509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Put the expressions (or parts of expressions) in variables. You can put the code the creates the variables in a text file that you include in the script with the include statement: $(Include=mysharedcodefile.qvs);&lt;/P&gt;&lt;P&gt;This way you can include the script file in many qlikview documents. You can then use the variables in chart expressions. If you need to change something you will only have to change it in one place, in the script file. The change will be applied to any document that uses the script file after reloading the document.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Dec 2013 11:33:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Code-reusability/m-p/535568#M1126509</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-12-30T11:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: Code reusability</title>
      <link>https://community.qlik.com/t5/QlikView/Code-reusability/m-p/535569#M1126510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can define your global variables with logic required.&lt;/P&gt;&lt;P&gt;And then you can use these variables as many times you like.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Dec 2013 11:37:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Code-reusability/m-p/535569#M1126510</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-12-30T11:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: Code reusability</title>
      <link>https://community.qlik.com/t5/QlikView/Code-reusability/m-p/535570#M1126511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Maybe user defined functions can help you here. These are defined as variables in the QlikView script, e.g.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;set&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Verdana; font-size: medium;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #808080; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;&lt;EM&gt;vDiffMonths&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Verdana; font-size: medium;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 9pt; font-family: 'Courier New';"&gt;= Round(interval(date($2) - date($1)) / 30);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;set&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Verdana; font-size: medium;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #808080; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;&lt;EM&gt;vDiffQuarters&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Verdana; font-size: medium;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 9pt; font-family: 'Courier New';"&gt;= Round(interval(date($2) - date($1)) / 90);&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;set&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Verdana; font-size: medium;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #808080; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;&lt;EM&gt;vDiffMonths2&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Verdana; font-size: medium;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 9pt; font-family: 'Courier New';"&gt;= ((YEAR(date($2))-YEAR(date($1)))*12)+(MONTH(date($2))-MONTH(date($1)));&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;set&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Verdana; font-size: medium;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #808080; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;&lt;EM&gt;vDiffQuarters2&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Verdana; font-size: medium;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 9pt; font-family: 'Courier New';"&gt;= ((YEAR(date($2))-YEAR(date($1)))*3)+(ceil(Month(date($2))/3)-ceil(Month(date($2))/3)); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;You would then reference the function like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #808080; font-size: 12px; font-family: Arial;"&gt;&lt;STRONG&gt;&lt;EM&gt;$(vDiffMonths('12/04/2011','05/02/2012'))&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="; color: #000000; font-size: 9pt; font-family: arial, helvetica, sans-serif;"&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 9pt; font-family: 'Courier New';"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;You can also store them in an Excel spreadsheet that can be imported into the QVW. This makes the functions easy to manage. See the solution that &lt;/SPAN&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;A href="https://community.qlik.com/qlik-users/126128"&gt;Karl Pover&lt;/A&gt; recommends here: &lt;A _jive_internal="true" href="https://community.qlik.com/message/89749"&gt;http://community.qlik.com/message/89749&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #808080; font-family: Arial; font-size: 12px;"&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Dec 2013 11:39:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Code-reusability/m-p/535570#M1126511</guid>
      <dc:creator />
      <dc:date>2013-12-30T11:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Code reusability</title>
      <link>https://community.qlik.com/t5/QlikView/Code-reusability/m-p/535571#M1126512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi, thanks for ur reply.. can u explain me how to creat that with any example...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Dec 2013 05:12:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Code-reusability/m-p/535571#M1126512</guid>
      <dc:creator>rash_611</dc:creator>
      <dc:date>2013-12-31T05:12:55Z</dc:date>
    </item>
  </channel>
</rss>

