<?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: Use a date/time strip in a SQL-select (like LOAD AS to a new field). in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Use-a-date-time-strip-in-a-SQL-select-like-LOAD-AS-to-a-new/m-p/1992300#M82111</link>
    <description>&lt;P&gt;Thanks. I hope it will help others too some day.&lt;/P&gt;</description>
    <pubDate>Thu, 13 Oct 2022 12:44:59 GMT</pubDate>
    <dc:creator>MrBosch</dc:creator>
    <dc:date>2022-10-13T12:44:59Z</dc:date>
    <item>
      <title>Use a date/time strip in a SQL-select (like LOAD AS to a new field).</title>
      <link>https://community.qlik.com/t5/App-Development/Use-a-date-time-strip-in-a-SQL-select-like-LOAD-AS-to-a-new/m-p/1990306#M81886</link>
      <description>&lt;P&gt;Hi all...&lt;/P&gt;
&lt;P&gt;I have been applying some suggestions from this great forum to get this one possible but to no success:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ODBC CONNECT TO [TP-LIVE-Admin];
LOAD
Date(Floor(ao_survey_start), 'DD-MM-YYYY') AS ao_survey_start_date,
Time(ao_survey_start, 'hh:mm:ss')          AS ao_survey_start_time;

SQL SELECT `ao_ip_address`,
    `ao_survey_start`,
    `ao_survey_submitted`    
FROM `clienttp`.ao;

SQL SELECT `as_ip_address`,
    `as_survey_start`,
    `as_survey_submitted`
FROM `clienttp`.as;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know how it works in the LOAD statement, but how to deal with this trimming/shaving whilst in a SQL select (or... can I just extract the date and time with a function in a plain TEXT-object? I read almost all solutions to be in the LOAD script...&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2022 16:24:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Use-a-date-time-strip-in-a-SQL-select-like-LOAD-AS-to-a-new/m-p/1990306#M81886</guid>
      <dc:creator>MrBosch</dc:creator>
      <dc:date>2022-10-07T16:24:20Z</dc:date>
    </item>
    <item>
      <title>Re: Use a date/time strip in a SQL-select (like LOAD AS to a new field).</title>
      <link>https://community.qlik.com/t5/App-Development/Use-a-date-time-strip-in-a-SQL-select-like-LOAD-AS-to-a-new/m-p/1990405#M81901</link>
      <description>&lt;P&gt;I'm assuming that the "ao_survey_start" field is coming in as a &lt;EM&gt;&lt;STRONG&gt;Timestamp&lt;/STRONG&gt;&lt;/EM&gt;.&amp;nbsp; If that's the case, you should be able to follow the guidance in this post.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.qlik.com/t5/New-to-Qlik-Sense/How-can-I-extract-Date-and-Time-from-Timestamp/td-p/1237957" target="_blank"&gt;https://community.qlik.com/t5/New-to-Qlik-Sense/How-can-I-extract-Date-and-Time-from-Timestamp/td-p/1237957&lt;/A&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Date(Floor([Changed Time Stamp])) as Date,
Time(Frac([Changed Time Stamp])) as Time&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2022 02:28:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Use-a-date-time-strip-in-a-SQL-select-like-LOAD-AS-to-a-new/m-p/1990405#M81901</guid>
      <dc:creator>JustinDallas</dc:creator>
      <dc:date>2022-10-08T02:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: Use a date/time strip in a SQL-select (like LOAD AS to a new field).</title>
      <link>https://community.qlik.com/t5/App-Development/Use-a-date-time-strip-in-a-SQL-select-like-LOAD-AS-to-a-new/m-p/1990414#M81903</link>
      <description>&lt;P&gt;Hi Justin Dallas (TX),&lt;/P&gt;
&lt;P&gt;Thanks for your reply. I think that I just did what you wrote. The 'difficulty' here has never been with dates or times splitting/extracting when I loaded some XLS file in the past.&lt;/P&gt;
&lt;P&gt;The difference: this time the fields are selected via an ODBC SQL Select. So I cannot just hit the 'Select' statement to modify the fields. I found out that you can still place a LOAD &lt;EM&gt;before&lt;/EM&gt; the Select statement, just like normal. That is what you see in my code.&lt;/P&gt;
&lt;P&gt;Unfortunately the script does run just fine but all SQL fields become unavailable and the two new 'load AS fields' are created but empty and 'alone' in the table view.&lt;/P&gt;
&lt;P&gt;An original &lt;STRONG&gt;ao_survey_start&lt;/STRONG&gt;&amp;nbsp;contains for example:&amp;nbsp;06-10-2022 22:28:12&lt;/P&gt;
&lt;P&gt;I think my problem has only to do with the 'how to deal with a sql select' in combination with a LOAD AS to get the date and time extracted.&lt;/P&gt;
&lt;P&gt;I will be experimenting and trial-and-erroring some more.&lt;/P&gt;
&lt;P&gt;Bosch, Addison (TX) &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2022 06:04:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Use-a-date-time-strip-in-a-SQL-select-like-LOAD-AS-to-a-new/m-p/1990414#M81903</guid>
      <dc:creator>MrBosch</dc:creator>
      <dc:date>2022-10-08T06:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: Use a date/time strip in a SQL-select (like LOAD AS to a new field).</title>
      <link>https://community.qlik.com/t5/App-Development/Use-a-date-time-strip-in-a-SQL-select-like-LOAD-AS-to-a-new/m-p/1990679#M81936</link>
      <description>&lt;P&gt;there are Two "&lt;STRONG&gt;SQL&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;" loads so you need A Preceding&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;LOAD for each SQL LOAD, but even better just Union your results into One SQL Load&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ODBC CONNECT TO [TP-LIVE-Admin];
Main:
LOAD
Date(Floor(ao_survey_start), 'DD-MM-YYYY') AS ao_survey_start_date,
Time(ao_survey_start, 'hh:mm:ss')          AS ao_survey_start_time;
SQL SELECT `ao_ip_address`,
    `ao_survey_start`,
    `ao_survey_submitted`    
FROM `clienttp`.ao
UNION
SELECT `as_ip_address`,
    `as_survey_start`,
    `as_survey_submitted`
FROM `clienttp`.as;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise&amp;nbsp; the load should be as below&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ODBC CONNECT TO [TP-LIVE-Admin];
Main:
LOAD
Date(Floor(ao_survey_start), 'DD-MM-YYYY') AS ao_survey_start_date,
Time(ao_survey_start, 'hh:mm:ss')          AS ao_survey_start_time;
SQL SELECT `ao_ip_address`,
    `ao_survey_start`,
    `ao_survey_submitted`    
FROM `clienttp`.ao;

Concatenate(Main)  
LOAD
Date(Floor(ao_survey_start), 'DD-MM-YYYY') AS ao_survey_start_date,
Time(ao_survey_start, 'hh:mm:ss')          AS ao_survey_start_time;
SQL  SELECT `as_ip_address`,
    `as_survey_start`,
    `as_survey_submitted`
FROM `clienttp`.as;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 09:48:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Use-a-date-time-strip-in-a-SQL-select-like-LOAD-AS-to-a-new/m-p/1990679#M81936</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2022-10-10T09:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: Use a date/time strip in a SQL-select (like LOAD AS to a new field).</title>
      <link>https://community.qlik.com/t5/App-Development/Use-a-date-time-strip-in-a-SQL-select-like-LOAD-AS-to-a-new/m-p/1991996#M82070</link>
      <description>&lt;P&gt;Thanks Vineeth Pujari,&lt;/P&gt;
&lt;P&gt;I found out that it did do the trick.&lt;/P&gt;
&lt;P&gt;One question remains though.&lt;/P&gt;
&lt;P&gt;If the SQL SELECT statement has more than only those 2 fields and when I only mention these 2 fields in the LOAD, are all other SQL Select fields being rejected/ignored by default?&lt;/P&gt;
&lt;P&gt;Since this was my initial situation before coming to the community:&lt;/P&gt;
&lt;P&gt;Load&lt;BR /&gt;e AS modified_e ........&lt;/P&gt;
&lt;P&gt;SQL SELECT&lt;BR /&gt;a,&lt;BR /&gt;b,&lt;BR /&gt;c,&lt;BR /&gt;d,&lt;BR /&gt;e,&lt;BR /&gt;f............&lt;/P&gt;
&lt;P&gt;And I lost all fields other than modified_e&lt;/P&gt;
&lt;P&gt;So, what I did was copying the full SQL SELECT fields list and paste them into the LOAD part (where now only the two fields are being modified as you and Justin described).&lt;/P&gt;
&lt;P&gt;Load&lt;BR /&gt;a,&amp;nbsp;&lt;BR /&gt;b,&amp;nbsp;&lt;BR /&gt;c,&lt;BR /&gt;d,&amp;nbsp;&lt;BR /&gt;e AS modified_e ........&lt;/P&gt;
&lt;P&gt;SQL SELECT&lt;BR /&gt;a,&lt;BR /&gt;b,&lt;BR /&gt;c,&lt;BR /&gt;d,&lt;BR /&gt;e ............&lt;/P&gt;
&lt;P&gt;And I got it all correctly. I did expect the two 'specialties' in the LOAD would not interfere with the other SQL SELECT 'load', but it did and will do so probaly in the future too.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is this normal?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Alex&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 23:33:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Use-a-date-time-strip-in-a-SQL-select-like-LOAD-AS-to-a-new/m-p/1991996#M82070</guid>
      <dc:creator>MrBosch</dc:creator>
      <dc:date>2022-10-12T23:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Use a date/time strip in a SQL-select (like LOAD AS to a new field).</title>
      <link>https://community.qlik.com/t5/App-Development/Use-a-date-time-strip-in-a-SQL-select-like-LOAD-AS-to-a-new/m-p/1992003#M82071</link>
      <description>&lt;P&gt;Think of Preceding LOAD in Qlik like Nested SQL Statements&lt;/P&gt;
&lt;P&gt;example&amp;nbsp; the below nested query will only load columns specified in the outermost select statement&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Select    tabA.a,tabA.b
From   ( Select a,b,c,d  from SomeTable )  tabA&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the Qlik Equivalent is Preceding LOAD where you load from previously loaded result&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Simply load all fields using &lt;FONT size="5" color="#FF6600"&gt;&lt;STRONG&gt;*&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5" color="#FF6600"&gt;&lt;STRONG&gt;example&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Load *
;
SQL Select a,b,c,d from sometable;

OR

Load *
,(y+z)/3.14 as newfield
;
Load *
,a+b as y
,c+d as z
;
SQL Select a,b,c,d from sometable;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 01:26:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Use-a-date-time-strip-in-a-SQL-select-like-LOAD-AS-to-a-new/m-p/1992003#M82071</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2022-10-13T01:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: Use a date/time strip in a SQL-select (like LOAD AS to a new field).</title>
      <link>https://community.qlik.com/t5/App-Development/Use-a-date-time-strip-in-a-SQL-select-like-LOAD-AS-to-a-new/m-p/1992300#M82111</link>
      <description>&lt;P&gt;Thanks. I hope it will help others too some day.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 12:44:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Use-a-date-time-strip-in-a-SQL-select-like-LOAD-AS-to-a-new/m-p/1992300#M82111</guid>
      <dc:creator>MrBosch</dc:creator>
      <dc:date>2022-10-13T12:44:59Z</dc:date>
    </item>
  </channel>
</rss>

