<?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: Create expression in Script rather than Front End in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Create-expression-in-Script-rather-than-Front-End/m-p/527159#M689437</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for all the responses. Swuehl, thanks for spotting my obvious mistake. I wasn't using the right expression in my load script because I was ignoring the &amp;lt;= sign.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Everything works fine now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Nov 2013 08:54:29 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-11-15T08:54:29Z</dc:date>
    <item>
      <title>Create expression in Script rather than Front End</title>
      <link>https://community.qlik.com/t5/QlikView/Create-expression-in-Script-rather-than-Front-End/m-p/527156#M689434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial,helvetica,sans-serif;"&gt;Hi guys,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;This should be pretty straight forward, but it is not working as expected for me.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;I have 5 expressions as follows &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: arial,helvetica,sans-serif;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;sum(C1_K)/&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;({&amp;lt;C_Date={'&amp;lt;=$(=today()-1)'}&amp;gt;}Value) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;sum(C21_K)/&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;({&amp;lt;C_Date={'&amp;lt;=$(=today()-21)'}&amp;gt;}Value) and so on&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;The expressions cause my front end to slow down when this chart is displayed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;I would like to move this to the script to simp-lify the calculation.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;I tried if(C_Date = today()-1, 1,0) as C1_K_Flag&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;When I put this back in my expression as sum(C1_K)/&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;(C1_K_Flag * Value), it doesn't work and comes up with a blank chart.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Can someone please tell me what I am doing wrong?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Thanks &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 14:39:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-expression-in-Script-rather-than-Front-End/m-p/527156#M689434</guid>
      <dc:creator />
      <dc:date>2013-11-14T14:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: Create expression in Script rather than Front End</title>
      <link>https://community.qlik.com/t5/QlikView/Create-expression-in-Script-rather-than-Front-End/m-p/527157#M689435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of moving all calcutations to script, I could create all variables into your script with this code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="_jivemacro_uid_13844457314533537 jive_text_macro jive_macro_code" jivemacro_uid="_13844457314533537"&gt;
&lt;P&gt;for i = 1 to 31&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Let varname='vC'&amp;amp;i&amp;amp;'_K';&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Let varvalue=date(Today() - i);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Let $(varname) = '$(varvalue)';&lt;/P&gt;
&lt;P&gt;next&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And then use&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d;"&gt;Sum(C1_K)/&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d;"&gt;({&amp;lt;C_Date={'&amp;lt;=$(vC1_K)'}&amp;gt;}Value)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 15:59:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-expression-in-Script-rather-than-Front-End/m-p/527157#M689435</guid>
      <dc:creator>Clever_Anjos</dc:creator>
      <dc:date>2013-11-14T15:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: Create expression in Script rather than Front End</title>
      <link>https://community.qlik.com/t5/QlikView/Create-expression-in-Script-rather-than-Front-End/m-p/527158#M689436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your script flag is checking for C_Date equal today()-1 while your set modifer is using a date range (&amp;lt;=today()-1).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could this explain something? If you don't have data for C_Date equal today()-1, all flags are zero and your expression won't return anything (div by zero).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 16:14:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-expression-in-Script-rather-than-Front-End/m-p/527158#M689436</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-11-14T16:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: Create expression in Script rather than Front End</title>
      <link>https://community.qlik.com/t5/QlikView/Create-expression-in-Script-rather-than-Front-End/m-p/527159#M689437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for all the responses. Swuehl, thanks for spotting my obvious mistake. I wasn't using the right expression in my load script because I was ignoring the &amp;lt;= sign.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Everything works fine now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Nov 2013 08:54:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-expression-in-Script-rather-than-Front-End/m-p/527159#M689437</guid>
      <dc:creator />
      <dc:date>2013-11-15T08:54:29Z</dc:date>
    </item>
  </channel>
</rss>

