<?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 Different Text() value for SQL-sourced dates in load script vs chart in Connectivity &amp; Data Prep</title>
    <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Different-Text-value-for-SQL-sourced-dates-in-load-script-vs/m-p/1925779#M10672</link>
    <description>&lt;P&gt;After spending the morning identifying the source of a date issue, I have found the following.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems that the &amp;lt;date&amp;gt; field being loaded from a SQL query has a different text value when evaluated in the load script versus when assigned to a variable versus when evaluated in a table/chart.&amp;nbsp;Can someone explain what's happening?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using this load script:&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;LIB CONNECT TO 'EDW Dev SSO';

Test:
Load
           DateDT
           ,Num(DateDT) as NumDateDT
            ,Text(DateDT) as TextDateDT
;
sql
select 		cast(getdate() as date) as DateDT
;

let vTextDateDT = Text(peek('DateDT',0,'Test'));

Test2:

Load
		Text(DateDT) as TextDateDT2
Resident Test;      &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;
&lt;P&gt;I get this data back:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="awwitas_2-1651593076384.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/78541i054BE6E55B538A22/image-size/medium?v=v2&amp;amp;px=400" role="button" title="awwitas_2-1651593076384.png" alt="awwitas_2-1651593076384.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;TextDateDT&amp;gt; is 'Text(DateDT)' evaluated in a preceding load and returns 44684&lt;/P&gt;
&lt;P&gt;&amp;lt;Text(DateDT)&amp;gt; is 'Text(DateDT)' evaluated in the table and returns '2022-05-03'&lt;/P&gt;
&lt;P&gt;&amp;lt;VarTextDateDT&amp;gt; is 'Text(DateDT)' evaluated using peek() in the load script to get the value of &amp;lt;DateDT&amp;gt; from the table&amp;nbsp;and returns '2022-05-03'&lt;/P&gt;
&lt;P&gt;&amp;lt;TextDateDT2&amp;gt; is 'Text(DateDT)' evaluated in a resident load and returns 44684&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is the dual value itself changing, or does the function operate differently in chart vs load? I can't find documentation either way.&lt;/P&gt;
&lt;P&gt;If it's relevant, I run into exactly the same issue if using timestamps instead of dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 May 2022 16:04:02 GMT</pubDate>
    <dc:creator>awwitas</dc:creator>
    <dc:date>2022-05-03T16:04:02Z</dc:date>
    <item>
      <title>Different Text() value for SQL-sourced dates in load script vs chart</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Different-Text-value-for-SQL-sourced-dates-in-load-script-vs/m-p/1925779#M10672</link>
      <description>&lt;P&gt;After spending the morning identifying the source of a date issue, I have found the following.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems that the &amp;lt;date&amp;gt; field being loaded from a SQL query has a different text value when evaluated in the load script versus when assigned to a variable versus when evaluated in a table/chart.&amp;nbsp;Can someone explain what's happening?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using this load script:&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;LIB CONNECT TO 'EDW Dev SSO';

Test:
Load
           DateDT
           ,Num(DateDT) as NumDateDT
            ,Text(DateDT) as TextDateDT
;
sql
select 		cast(getdate() as date) as DateDT
;

let vTextDateDT = Text(peek('DateDT',0,'Test'));

Test2:

Load
		Text(DateDT) as TextDateDT2
Resident Test;      &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;
&lt;P&gt;I get this data back:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="awwitas_2-1651593076384.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/78541i054BE6E55B538A22/image-size/medium?v=v2&amp;amp;px=400" role="button" title="awwitas_2-1651593076384.png" alt="awwitas_2-1651593076384.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;TextDateDT&amp;gt; is 'Text(DateDT)' evaluated in a preceding load and returns 44684&lt;/P&gt;
&lt;P&gt;&amp;lt;Text(DateDT)&amp;gt; is 'Text(DateDT)' evaluated in the table and returns '2022-05-03'&lt;/P&gt;
&lt;P&gt;&amp;lt;VarTextDateDT&amp;gt; is 'Text(DateDT)' evaluated using peek() in the load script to get the value of &amp;lt;DateDT&amp;gt; from the table&amp;nbsp;and returns '2022-05-03'&lt;/P&gt;
&lt;P&gt;&amp;lt;TextDateDT2&amp;gt; is 'Text(DateDT)' evaluated in a resident load and returns 44684&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is the dual value itself changing, or does the function operate differently in chart vs load? I can't find documentation either way.&lt;/P&gt;
&lt;P&gt;If it's relevant, I run into exactly the same issue if using timestamps instead of dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 16:04:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Different-Text-value-for-SQL-sourced-dates-in-load-script-vs/m-p/1925779#M10672</guid>
      <dc:creator>awwitas</dc:creator>
      <dc:date>2022-05-03T16:04:02Z</dc:date>
    </item>
  </channel>
</rss>

