<?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: Duration text to Seconds in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Duration-text-to-Seconds/m-p/1363496#M617053</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-users/211044"&gt;pskumars&lt;/A&gt; When you have values like, 1&lt;STRONG&gt; Day, 1 Month, 1 Minute&lt;/STRONG&gt;, then I think this solution might not work. Also in future you will have the more data in which there might be possibility of getting strings like 1 Year as well.Please refer to my solution in that case.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Jun 2017 07:11:46 GMT</pubDate>
    <dc:creator>Kushal_Chawda</dc:creator>
    <dc:date>2017-06-28T07:11:46Z</dc:date>
    <item>
      <title>Duration text to Seconds</title>
      <link>https://community.qlik.com/t5/QlikView/Duration-text-to-Seconds/m-p/1363491#M617048</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;I have a list box duration values which was a string and i need to convert in seconds at&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;IMG alt="listbox.JPG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/168168_listbox.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jun 2017 06:38:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Duration-text-to-Seconds/m-p/1363491#M617048</guid>
      <dc:creator>pskumars</dc:creator>
      <dc:date>2017-06-27T06:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Duration text to Seconds</title>
      <link>https://community.qlik.com/t5/QlikView/Duration-text-to-Seconds/m-p/1363492#M617049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It can be done in script, this will enable you to show the field duration as text or as a numeric value, where the value is the amount of seconds.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;durationtable:&lt;/P&gt;&lt;P&gt;load dual(duration, durationSeconds) as duration;&lt;/P&gt;&lt;P&gt;load duration, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (days * 24 * 60 * 60) + (hours * 60 * 60) + (minutes * 60) + (seconds) as durationSeconds&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;load duration,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; days,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; right(hours, len(hours)-index(hours, ' ', SubStringCount(hours, ' '))) as hours,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; right(minutes, len(minutes)-index(minutes, ' ', SubStringCount(minutes, ' '))) as minutes,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; right(seconds, len(seconds)-index(seconds, ' ', SubStringCount(seconds, ' '))) as seconds&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;load duration, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(index(duration, 'Day'), trim(subfield(duration, 'Day', 1)), 0) as days, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(index(duration, 'Hours'), trim(subfield(duration, 'Hours', 1)), 0) as hours,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(index(duration, 'Minutes'), trim(subfield(duration, 'Minutes', 1)), 0) as minutes,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(index(duration, 'Seconds'), trim(subfield(duration, 'Seconds', 1)), 0) as seconds&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;load * inline [&lt;/P&gt;&lt;P&gt;duration&lt;/P&gt;&lt;P&gt;2 Days 14 Hours 45 Minutes&lt;/P&gt;&lt;P&gt;21 Seconds&lt;/P&gt;&lt;P&gt;6 Hours 52 Minutes&lt;/P&gt;&lt;P&gt;1 Day 2 Hours 52 Minutes 3 Seconds&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want separate text fields and numeric fields you can just remove the line "load dual(duration, durationSeconds) as duration;"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jun 2017 07:02:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Duration-text-to-Seconds/m-p/1363492#M617049</guid>
      <dc:creator>henrikalmen</dc:creator>
      <dc:date>2017-06-27T07:02:47Z</dc:date>
    </item>
    <item>
      <title>Re: Duration text to Seconds</title>
      <link>https://community.qlik.com/t5/QlikView/Duration-text-to-Seconds/m-p/1363493#M617050</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;Try (look attached file)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Evaluate(Replace(Replace(Replace(Replace(Replace(Data, ' Days', '*86400'), ' Hours', '*3600'), ' Minutes', '*60'), ' Seconds', ''), ' ', '+'));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Result&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;IMG alt="1.jpg" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/168171_1.jpg" style="height: auto;" /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Andrey&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jun 2017 07:18:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Duration-text-to-Seconds/m-p/1363493#M617050</guid>
      <dc:creator>ahaahaaha</dc:creator>
      <dc:date>2017-06-27T07:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: Duration text to Seconds</title>
      <link>https://community.qlik.com/t5/QlikView/Duration-text-to-Seconds/m-p/1363494#M617051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Time:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; interval(Seconds/86400,'hh:mm:ss') as Time;&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;if(wildmatch(lower(SubField(Duration,' ',2)),'*year*'),SubField(Duration,' ',1)*31104000 +&lt;/P&gt;&lt;P&gt;SubField(Duration,' ',3)*2592000+SubField(Duration,' ',5)*86400+SubField(Duration,' ',7)*3600+&lt;/P&gt;&lt;P&gt;SubField(Duration,' ',9)*60+SubField(Duration,' ',11),&lt;/P&gt;&lt;P&gt;if(wildmatch(lower(SubField(Duration,' ',2)),'*month*'),&lt;/P&gt;&lt;P&gt;SubField(Duration,' ',1)*2592000+SubField(Duration,' ',3)*86400+SubField(Duration,' ',5)*3600+&lt;/P&gt;&lt;P&gt;SubField(Duration,' ',7)*60+SubField(Duration,' ',9),&lt;/P&gt;&lt;P&gt;if(wildmatch(lower(SubField(Duration,' ',2)),'*day*'),&lt;/P&gt;&lt;P&gt;SubField(Duration,' ',1)*86400+SubField(Duration,' ',3)*3600+&lt;/P&gt;&lt;P&gt;SubField(Duration,' ',5)*60+SubField(Duration,' ',7),&lt;/P&gt;&lt;P&gt;if(wildmatch(lower(SubField(Duration,' ',2)),'*hour*'),&lt;/P&gt;&lt;P&gt;SubField(Duration,' ',1)*3600+SubField(Duration,' ',3)*60+SubField(Duration,' ',5),&lt;/P&gt;&lt;P&gt;if(wildmatch(lower(SubField(Duration,' ',2)),'*minute*'),&lt;/P&gt;&lt;P&gt;SubField(Duration,' ',1)*60+SubField(Duration,' ',3),&lt;/P&gt;&lt;P&gt;if(wildmatch(lower(SubField(Duration,' ',2)),'*second*'),&lt;/P&gt;&lt;P&gt;SubField(Duration,' ',1))))))) as Seconds&lt;/P&gt;&lt;P&gt;Inline [&lt;/P&gt;&lt;P&gt;Duration&lt;/P&gt;&lt;P&gt;1 Year 11 Months 11 Days 1 Hour 11 Minutes 30 Seconds&lt;/P&gt;&lt;P&gt;2 Months 3 Days 1 Hour 9 Minutes 29 Seconds&lt;/P&gt;&lt;P&gt;3 Days 18 Hours 24 Minutes 35 Seconds&lt;/P&gt;&lt;P&gt;19 Minutes 39 Seconds&lt;/P&gt;&lt;P&gt;1 Day 18 Hours 19 Minutes 36 Seconds&lt;/P&gt;&lt;P&gt;30 Seconds&lt;/P&gt;&lt;P&gt;14 Hours 22 Minutes 38 Seconds ];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.JPG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/168174_Capture.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jun 2017 07:23:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Duration-text-to-Seconds/m-p/1363494#M617051</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2017-06-27T07:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: Duration text to Seconds</title>
      <link>https://community.qlik.com/t5/QlikView/Duration-text-to-Seconds/m-p/1363495#M617052</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;another example: &lt;A href="https://community.qlik.com/message/1212704"&gt;Re: Convert string to the timestamp&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&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;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jun 2017 23:54:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Duration-text-to-Seconds/m-p/1363495#M617052</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2017-06-27T23:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: Duration text to Seconds</title>
      <link>https://community.qlik.com/t5/QlikView/Duration-text-to-Seconds/m-p/1363496#M617053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-users/211044"&gt;pskumars&lt;/A&gt; When you have values like, 1&lt;STRONG&gt; Day, 1 Month, 1 Minute&lt;/STRONG&gt;, then I think this solution might not work. Also in future you will have the more data in which there might be possibility of getting strings like 1 Year as well.Please refer to my solution in that case.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jun 2017 07:11:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Duration-text-to-Seconds/m-p/1363496#M617053</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2017-06-28T07:11:46Z</dc:date>
    </item>
  </channel>
</rss>

