<?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 Some String Manipulation in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Some-String-Manipulation/m-p/1891956#M1217332</link>
    <description>&lt;P&gt;hello all,&lt;/P&gt;
&lt;P&gt;I am reading a value that looks something like this....&lt;/P&gt;
&lt;P&gt;1/31/2022 0:0:0 AM SAST&lt;/P&gt;
&lt;P&gt;I need to deduct the date from that field, subtract it from today, and get the Days difference.&lt;/P&gt;
&lt;P&gt;So what I'm currently doing:&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp; left(ATTR_VALUE,(index(ATTR_VALUE,' ')) - 1)&amp;nbsp; &amp;nbsp;...I look for the first space and read everything to the left of it. This returns '1/31/2022'. It is NOT in date format yet so I do the following:&lt;/P&gt;
&lt;P&gt;2.&amp;nbsp;date(date#(left(ATTR_VALUE,(index(ATTR_VALUE,' ')) - 1),'mm/dd/yyyy'),'YYYY/MM/DD')....this returns '2022/01/31' which is correct&lt;/P&gt;
&lt;P&gt;3. Then I need to get the Days difference between Today() and the date in point (2)...&lt;/P&gt;
&lt;P&gt;INTERVAL(TODAY() -&amp;nbsp;date(date#(left(ATTR_VALUE,(index(ATTR_VALUE,' ')) - 1),'mm/dd/yyyy'),'YYYY/MM/DD'),'D') as DaysDiffernce - which returns 10 days (as at today)&lt;/P&gt;
&lt;P&gt;That is a LOT of coding to get a result....is there a quicker way of achieving the same result?&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 11 Feb 2022 13:10:08 GMT</pubDate>
    <dc:creator>QFanatic</dc:creator>
    <dc:date>2022-02-11T13:10:08Z</dc:date>
    <item>
      <title>Some String Manipulation</title>
      <link>https://community.qlik.com/t5/QlikView/Some-String-Manipulation/m-p/1891956#M1217332</link>
      <description>&lt;P&gt;hello all,&lt;/P&gt;
&lt;P&gt;I am reading a value that looks something like this....&lt;/P&gt;
&lt;P&gt;1/31/2022 0:0:0 AM SAST&lt;/P&gt;
&lt;P&gt;I need to deduct the date from that field, subtract it from today, and get the Days difference.&lt;/P&gt;
&lt;P&gt;So what I'm currently doing:&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp; left(ATTR_VALUE,(index(ATTR_VALUE,' ')) - 1)&amp;nbsp; &amp;nbsp;...I look for the first space and read everything to the left of it. This returns '1/31/2022'. It is NOT in date format yet so I do the following:&lt;/P&gt;
&lt;P&gt;2.&amp;nbsp;date(date#(left(ATTR_VALUE,(index(ATTR_VALUE,' ')) - 1),'mm/dd/yyyy'),'YYYY/MM/DD')....this returns '2022/01/31' which is correct&lt;/P&gt;
&lt;P&gt;3. Then I need to get the Days difference between Today() and the date in point (2)...&lt;/P&gt;
&lt;P&gt;INTERVAL(TODAY() -&amp;nbsp;date(date#(left(ATTR_VALUE,(index(ATTR_VALUE,' ')) - 1),'mm/dd/yyyy'),'YYYY/MM/DD'),'D') as DaysDiffernce - which returns 10 days (as at today)&lt;/P&gt;
&lt;P&gt;That is a LOT of coding to get a result....is there a quicker way of achieving the same result?&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 13:10:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Some-String-Manipulation/m-p/1891956#M1217332</guid>
      <dc:creator>QFanatic</dc:creator>
      <dc:date>2022-02-11T13:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: Some String Manipulation</title>
      <link>https://community.qlik.com/t5/QlikView/Some-String-Manipulation/m-p/1891984#M1217334</link>
      <description>&lt;P&gt;One alternative is the following:&lt;/P&gt;&lt;P&gt;1) Use Subfield() in the script to extract the date:&lt;BR /&gt;SubField(ATTR_VALUE,' ',1)&lt;/P&gt;&lt;P&gt;2) Interpret this string - also in the script:&lt;BR /&gt;Date#(SubField(ATTR_VALUE,' ',1),'M/D/YYYY') as MyDate&lt;/P&gt;&lt;P&gt;2) No need to format intermediate results. You get the right answer simply by using:&lt;BR /&gt;Today() - MyDate as Difference&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 14:00:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Some-String-Manipulation/m-p/1891984#M1217334</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2022-02-11T14:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: Some String Manipulation</title>
      <link>https://community.qlik.com/t5/QlikView/Some-String-Manipulation/m-p/1891988#M1217335</link>
      <description>&lt;P&gt;It depends. If you find a valid format-pattern for your timestamp the following might be enough:&lt;/P&gt;
&lt;P&gt;interval(today() - timestamp#(FIELD, 'Format'), 'D')&lt;/P&gt;
&lt;P&gt;I'm not sure if SAST could be fetched with the format-pattern. If not you need any additional measure like your cutting-method or maybe a removing with replace() or keepchar() or purgechar(). The next point is could there be real time-parts - if yes you may need a floor() to remove it (depends if you just show 'D' with interval() or if you want to calculate further with the result).&lt;/P&gt;
&lt;P&gt;In each case you could remove the date() within your logic. Another approach to keep the script or expression more readable would be to place the logic within a (parametrized) variable.&lt;/P&gt;
&lt;P&gt;- Marcus&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 14:16:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Some-String-Manipulation/m-p/1891988#M1217335</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2022-02-11T14:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: Some String Manipulation</title>
      <link>https://community.qlik.com/t5/QlikView/Some-String-Manipulation/m-p/1892006#M1217337</link>
      <description>&lt;P&gt;I'm honored - two Guru's answering my question.&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Thank you so much!&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 15:03:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Some-String-Manipulation/m-p/1892006#M1217337</guid>
      <dc:creator>QFanatic</dc:creator>
      <dc:date>2022-02-11T15:03:52Z</dc:date>
    </item>
  </channel>
</rss>

