<?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 avoid hard coding in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-avoid-hard-coding/m-p/1411379#M426777</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;You can create two variables like :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vDateStart = YearStart(Today()); //you can use addyears, addmonths...&lt;/P&gt;&lt;P&gt;LET vDateEnd&amp;nbsp; = YearEnd(Today()); //you can use addyears, addmonths...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And in your SQL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sql Select [...]&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;AL1.FIRST_FUNDED_DT BETWEEN TIMESTAMP '$(vDateStart)' AND TIMESTAMP &lt;SPAN style="color: #3d3d3d; font-family: inherit; font-style: inherit;"&gt;&lt;STRONG&gt;'$(vDateEnd)'&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;&lt;STRONG style="color: #3d3d3d; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;&lt;STRONG style="color: #3d3d3d; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Aurélien&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;&lt;STRONG style="color: #3d3d3d; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Nov 2017 08:58:46 GMT</pubDate>
    <dc:creator>Aurelien_Martinez</dc:creator>
    <dc:date>2017-11-17T08:58:46Z</dc:date>
    <item>
      <title>How to avoid hard coding</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-avoid-hard-coding/m-p/1411378#M426776</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;what is the best way to get the future data into the SQL query without hard coding the date in the SQL query while loading the SQL query in data loader?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;below is my SQL query in which i have hard coded my date directly in order to get the future data .Plzz suggest?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT AL1.ACCT, AL1.REG_CAT_COARSE, AL1.FIRST_FUNDED_DT, SUM ( AL2.TXN_CNT ),&lt;/P&gt;&lt;P&gt;(case when (SUM ( AL2.TXN_CNT )) &amp;gt; 0&amp;nbsp; then 'Y' else 'N' end),AL2.PROCESS_DATE, &lt;/P&gt;&lt;P&gt;AL1.POE_CAT, (case when AL1.BUS_LINE = 'PAS' then 'PAS' when AL1.BUS_LINE = 'SMAF' then 'PAS'&lt;/P&gt;&lt;P&gt;when AL1.BUS_LINE = 'UMA' then 'PAS' when AL1.BUS_LINE = 'UMAT' then 'PAS' when AL1.BUS_LINE = 'BDI' then &lt;/P&gt;&lt;P&gt;'PAS' when AL1.BUS_LINE = 'SMEI' then 'PAS' when AL1.BUS_LINE = 'SMLC' then 'PAS' when AL1.BUS_LINE = 'DMA' &lt;/P&gt;&lt;P&gt;then 'PAS' when AL1.BUS_LINE = 'PWM' then 'PAS' when AL1.BUS_LINE = 'PWMT' then 'PAS' else 'Non PAS' end), &lt;/P&gt;&lt;P&gt;AL1.HH, AL1.BUS_LINE, AL1.CIT_STATE, AL1.CITY, AL1.ORIGIN, AL1.STATE, AL1.ZIP, AL1.RETIRE_INDIC, AL1.ACCT_TYPE, &lt;/P&gt;&lt;P&gt;AL1.ACCT_STATUS FROM PLVDBO.ACCOUNT AL1, PLVDBO.A_FIN_TXN_DTL AL2 WHERE ( AL1.ACCT = AL2.ACCT (+))&amp;nbsp; AND&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;((AL1.FIRST_FUNDED_DT BETWEEN TIMESTAMP '2015-01-01 00:00:00.000' AND TIMESTAMP '2050-12-31 00:00:00.000' AND &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AL2.PROCESS_DATE(+) BETWEEN TIMESTAMP '2015-01-01 00:00:00.000' AND TIMESTAMP '2050-12-31 00:00:00.000' AND &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;AL2.COMM_TRADE_INDIC(+)='Y')) GROUP BY AL1.ACCT, AL1.REG_CAT_COARSE, AL1.FIRST_FUNDED_DT, AL1.POE_CAT,&lt;/P&gt;&lt;P&gt;(case when AL1.BUS_LINE = 'PAS' then 'PAS' when AL1.BUS_LINE = 'SMAF' then 'PAS' when AL1.BUS_LINE = 'UMA' &lt;/P&gt;&lt;P&gt;then 'PAS' when AL1.BUS_LINE = 'UMAT' then 'PAS' when AL1.BUS_LINE = 'BDI' then 'PAS' when AL1.BUS_LINE = 'SMEI' &lt;/P&gt;&lt;P&gt;then 'PAS' when AL1.BUS_LINE = 'SMLC' then 'PAS' when AL1.BUS_LINE = 'DMA' then 'PAS' when AL1.BUS_LINE = 'PWM' &lt;/P&gt;&lt;P&gt;then 'PAS' when AL1.BUS_LINE = 'PWMT' then 'PAS' else 'Non PAS' end), AL1.HH, &lt;/P&gt;&lt;P&gt;AL1.BUS_LINE, AL1.CIT_STATE, AL1.CITY, AL1.ORIGIN, AL1.STATE, AL1.ZIP, AL1.RETIRE_INDIC, &lt;/P&gt;&lt;P&gt;AL1.ACCT_TYPE, AL1.ACCT_STATUS,AL2.PROCESS_DATE;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Nov 2017 08:52:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-avoid-hard-coding/m-p/1411378#M426776</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-17T08:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid hard coding</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-avoid-hard-coding/m-p/1411379#M426777</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;You can create two variables like :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vDateStart = YearStart(Today()); //you can use addyears, addmonths...&lt;/P&gt;&lt;P&gt;LET vDateEnd&amp;nbsp; = YearEnd(Today()); //you can use addyears, addmonths...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And in your SQL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sql Select [...]&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;AL1.FIRST_FUNDED_DT BETWEEN TIMESTAMP '$(vDateStart)' AND TIMESTAMP &lt;SPAN style="color: #3d3d3d; font-family: inherit; font-style: inherit;"&gt;&lt;STRONG&gt;'$(vDateEnd)'&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;&lt;STRONG style="color: #3d3d3d; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;&lt;STRONG style="color: #3d3d3d; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Aurélien&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;&lt;STRONG style="color: #3d3d3d; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Nov 2017 08:58:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-avoid-hard-coding/m-p/1411379#M426777</guid>
      <dc:creator>Aurelien_Martinez</dc:creator>
      <dc:date>2017-11-17T08:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid hard coding</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-avoid-hard-coding/m-p/1411380#M426778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am getting this below error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="error.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/183657_error.PNG" style="height: 444px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Nov 2017 09:28:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-avoid-hard-coding/m-p/1411380#M426778</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-17T09:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid hard coding</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-avoid-hard-coding/m-p/1411381#M426779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;You have an issue with the date format,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can try :&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;LET vDateStart = Date(YearStart(Today()), 'YYYY-MM-DD'); &lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;LET vDateEnd&amp;nbsp; = Date(YearEnd(Today()&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;, 'YYYY-MM-DD'&lt;/SPAN&gt;);&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;or &lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;to_date in your sql&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Aurélien&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Nov 2017 09:41:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-avoid-hard-coding/m-p/1411381#M426779</guid>
      <dc:creator>Aurelien_Martinez</dc:creator>
      <dc:date>2017-11-17T09:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid hard coding</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-avoid-hard-coding/m-p/1411382#M426780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Surya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is most likely due to the fact that you need to provide a timestamp and the YearStart and YearEnd functions that Aurelien suggested as solutions return a date string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You might want to wrap the functions as such:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;LET vDateStart = Timestamp(YearStart(Today()), 'YYYY-MM-DD hh:mm:ss.fff')&lt;/P&gt;
&lt;P&gt;LET vDateEnd&amp;nbsp; = Timestamp(YearEnd(Today()), 'YYYY-MM-DD hh:mm:ss.fff')&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Nov 2017 09:42:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-avoid-hard-coding/m-p/1411382#M426780</guid>
      <dc:creator>calexandru</dc:creator>
      <dc:date>2017-11-17T09:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid hard coding</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-avoid-hard-coding/m-p/1411383#M426781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alex &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its working now..../can you explain me the working functionality of the above function&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Nov 2017 10:03:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-avoid-hard-coding/m-p/1411383#M426781</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-17T10:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid hard coding</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-avoid-hard-coding/m-p/1411384#M426782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad it works,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sure thing, timestamp() deals with formatting an expression in either the system timestamp format or a user defined format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It takes two arguments with the second being optional.&lt;/P&gt;&lt;P&gt;first parameter must be a valid interpretation of either a date or timestamp and the second is the format you want to format the timestamp in.&lt;/P&gt;&lt;P&gt;In your case you have the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Today() which returns the date for the current day&lt;/P&gt;&lt;P&gt;YearStart() which returns the first date of the year for the parameter you provided, in this case&lt;/P&gt;&lt;P&gt;and lastly timestamp() converts the date into a timestamp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code looks like this:&lt;/P&gt;&lt;P&gt;Today() -&amp;gt; 17/11/2017&lt;/P&gt;&lt;P&gt;YearStart(17/11/2017) -&amp;gt; 01/01/2017&lt;/P&gt;&lt;P&gt;Timestamp(01/01/2017, 'YYYY-MM-DD hh:mm:ss.fff') -&amp;gt; 2017-01-01 00:00:00.000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Nov 2017 10:22:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-avoid-hard-coding/m-p/1411384#M426782</guid>
      <dc:creator>calexandru</dc:creator>
      <dc:date>2017-11-17T10:22:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid hard coding</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-avoid-hard-coding/m-p/1411385#M426783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot Alex...Your explanation is crystal clear &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Nov 2017 11:02:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-avoid-hard-coding/m-p/1411385#M426783</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-17T11:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid hard coding</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-avoid-hard-coding/m-p/1411386#M426784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My pleasure Surya &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Nov 2017 11:04:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-avoid-hard-coding/m-p/1411386#M426784</guid>
      <dc:creator>calexandru</dc:creator>
      <dc:date>2017-11-17T11:04:02Z</dc:date>
    </item>
  </channel>
</rss>

