<?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: Format field as text in direct query? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Format-field-as-text-in-direct-query/m-p/131176#M601313</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Bump.&lt;/SPAN&gt;&lt;P class=""&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 20 Oct 2018 10:21:53 GMT</pubDate>
    <dc:creator>RSvebeck</dc:creator>
    <dc:date>2018-10-20T10:21:53Z</dc:date>
    <item>
      <title>Format field as text in direct query?</title>
      <link>https://community.qlik.com/t5/QlikView/Format-field-as-text-in-direct-query/m-p/131175#M601312</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;The unique identifier for items "&lt;SPAN style="color: #575757; font-family: arial,helvetica,sans-serif; font-size: 13.33px; font-style: normal; font-weight: 400; text-align: left; text-indent: 0px;"&gt;ItemNo&lt;/SPAN&gt;" in our database (DB2) is containing only numbers (but is stored in the database as varchar). Some item numbers are having leading zeros, for example item 00123 which is not the same as item 0123 or item 123.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Normally we solve this issue in QLIKVIEW LOAD by using the text() function, to keep leading zeros after the load.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;LOAD&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; text(ItemNo) as ItemNo&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;FROM … etc&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that when using &lt;STRONG&gt;Direct Query&lt;/STRONG&gt; we seem to not be able to use QLIKVIEW functions, hence the ItemNo field is formated as number(since it only contains numbers), and we loose the ability to differentiate the items &lt;SPAN style="color: #575757; font-family: arial,helvetica,sans-serif; font-size: 13.33px; font-style: normal; font-weight: 400; text-align: left; text-indent: 0px;"&gt;00123,0123, 123&lt;/SPAN&gt; because they all are read as 123.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;DIRECT QUERY&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;DIMENSION&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ItemNo&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;MEASURE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Weight&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;FROM DB2.Database&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We tried using preceeding load like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;LOAD text(ItemNo) as ItemNo;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #575757; font-family: arial,helvetica,sans-serif; font-size: 13.33px; font-style: normal; font-weight: 400; text-align: left; text-indent: 0px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;DIRECT QUERY&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #575757; font-family: arial,helvetica,sans-serif; font-size: 13.33px; font-style: normal; font-weight: 400; text-align: left; text-indent: 0px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;DIMENSION&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #575757; font-family: arial,helvetica,sans-serif; font-size: 13.33px; font-style: normal; font-weight: 400; text-align: left; text-indent: 0px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ItemNo&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #575757; font-family: arial,helvetica,sans-serif; font-size: 13.33px; font-style: normal; font-weight: 400; text-align: left; text-indent: 0px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;MEASURE&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #575757; font-family: arial,helvetica,sans-serif; font-size: 13.33px; font-style: normal; font-weight: 400; text-align: left; text-indent: 0px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Weight&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #575757; font-family: arial,helvetica,sans-serif; font-size: 13.33px; font-style: normal; font-weight: 400; text-align: left; text-indent: 0px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;FROM DB2.Database&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It did not work….&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We also tried using NATIVE function like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;DIRECT QUERY&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;DIMENSION&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NATIVE('CAST (ItemNo as &lt;SPAN style="text-align: left; color: #222222; text-indent: 0px; font-size: 13.2px; font-weight: 400; background-color: #e0ecf8;"&gt;VARCHAR(5))') as &lt;SPAN style="text-align: left; color: #575757; text-indent: 0px; font-size: 13.33px; font-weight: 400;"&gt;ItemNo &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;MEASURE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Weight&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;FROM DB2.Database&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did not work either. QLIKVIEW still only see numbers and remove the leading zeros...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can we make sure fields are in TEXT format using DIRECT QUERY?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2018 12:39:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Format-field-as-text-in-direct-query/m-p/131175#M601312</guid>
      <dc:creator>RSvebeck</dc:creator>
      <dc:date>2018-10-03T12:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: Format field as text in direct query?</title>
      <link>https://community.qlik.com/t5/QlikView/Format-field-as-text-in-direct-query/m-p/131176#M601313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Bump.&lt;/SPAN&gt;&lt;P class=""&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 20 Oct 2018 10:21:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Format-field-as-text-in-direct-query/m-p/131176#M601313</guid>
      <dc:creator>RSvebeck</dc:creator>
      <dc:date>2018-10-20T10:21:53Z</dc:date>
    </item>
  </channel>
</rss>

