<?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: Best way to parse timestamp (obtained from SQL) into separate date fields in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Best-way-to-parse-timestamp-obtained-from-SQL-into-separate-date/m-p/625694#M230114</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should first load data using your SELECT statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ServerLogs:&lt;/P&gt;&lt;P&gt;Load *, Floor(startTime) as Date;&lt;/P&gt;&lt;P&gt;SQL SELECT DISTINCT event_id, startTime FROM server.logs;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The preceding Load is a QlikView syntax to load from the SELECT - or to transform the output of the SELECT. Then you load a Master Calendar using the above table as source:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Calendar:&lt;/P&gt;&lt;P&gt;Load distinct&lt;/P&gt;&lt;P&gt;&amp;nbsp; Date,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Month(Date) as Month&lt;/P&gt;&lt;P&gt;&amp;nbsp; Resident ServerLogs;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And you can add more fields in the Calendar: Week, Year, etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Feb 2014 21:43:54 GMT</pubDate>
    <dc:creator>hic</dc:creator>
    <dc:date>2014-02-24T21:43:54Z</dc:date>
    <item>
      <title>Best way to parse timestamp (obtained from SQL) into separate date fields</title>
      <link>https://community.qlik.com/t5/QlikView/Best-way-to-parse-timestamp-obtained-from-SQL-into-separate-date/m-p/625692#M230112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a timestamp field (startTime) that I am obtaining through the following SQL stmt in my script:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;SQL SELECT DISTINCT event_id,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; startTime,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM server.logs;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then in my QlikView charts I am processing the dimension using a conditional:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;= if (DateRangeUnit = 'Years', Year( startTime ),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if (DateRangeUnit = 'Months', MonthName( startTime ),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if (DateRangeUnit = 'Weeks', Date( WeekStart( startTime ) ),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if (DateRangeUnit = 'Days', DayName( startTime )))))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For efficiency, I am trying to do as many calculations ahead of time in my script, so trying to create new fields for Year, Months, Weeks, Days. So, essentially looking for something like this, but this isn't possible (obvious SQL errors):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;SQL SELECT DISTINCT event_id,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; startTime,&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Year( startTime ) as year,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MonthName( startTime ) as month,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date( WeekStart( startTime ) ) as week,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DayName( startTime ) as day,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM server.logs;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, would I just grab the startTime as usual and them make a different table (or tables) that handles the unique dates?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Feb 2014 21:13:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Best-way-to-parse-timestamp-obtained-from-SQL-into-separate-date/m-p/625692#M230112</guid>
      <dc:creator />
      <dc:date>2014-02-24T21:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to parse timestamp (obtained from SQL) into separate date fields</title>
      <link>https://community.qlik.com/t5/QlikView/Best-way-to-parse-timestamp-obtained-from-SQL-into-separate-date/m-p/625693#M230113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;Jessica Ben wrote:&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="padding: 0px; height: 8pt; min-height: 8pt;"&gt;&lt;/P&gt;
&lt;P&gt;So, would I just grab the startTime as usual and them make a different table (or tables) that handles the unique dates?&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;Yes:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; event_id,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; year(event_id) as Year,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; month(event_id) as Month,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; weekstart(event_id) as Week,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; weekday(event_id) as weekday,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; day(event_id) as Day,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date(floor(event_id)) as Date;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;SQL SELECT &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; event_id,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; startTime&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;FROM server.logs;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Feb 2014 21:41:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Best-way-to-parse-timestamp-obtained-from-SQL-into-separate-date/m-p/625693#M230113</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-02-24T21:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to parse timestamp (obtained from SQL) into separate date fields</title>
      <link>https://community.qlik.com/t5/QlikView/Best-way-to-parse-timestamp-obtained-from-SQL-into-separate-date/m-p/625694#M230114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should first load data using your SELECT statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ServerLogs:&lt;/P&gt;&lt;P&gt;Load *, Floor(startTime) as Date;&lt;/P&gt;&lt;P&gt;SQL SELECT DISTINCT event_id, startTime FROM server.logs;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The preceding Load is a QlikView syntax to load from the SELECT - or to transform the output of the SELECT. Then you load a Master Calendar using the above table as source:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Calendar:&lt;/P&gt;&lt;P&gt;Load distinct&lt;/P&gt;&lt;P&gt;&amp;nbsp; Date,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Month(Date) as Month&lt;/P&gt;&lt;P&gt;&amp;nbsp; Resident ServerLogs;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And you can add more fields in the Calendar: Week, Year, etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Feb 2014 21:43:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Best-way-to-parse-timestamp-obtained-from-SQL-into-separate-date/m-p/625694#M230114</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2014-02-24T21:43:54Z</dc:date>
    </item>
  </channel>
</rss>

