<?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: Parsing fields from a string in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Parsing-fields-from-a-string/m-p/981162#M649690</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're welcome&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>Mon, 21 Sep 2015 09:38:47 GMT</pubDate>
    <dc:creator>MarcoWedel</dc:creator>
    <dc:date>2015-09-21T09:38:47Z</dc:date>
    <item>
      <title>Parsing fields from a string</title>
      <link>https://community.qlik.com/t5/QlikView/Parsing-fields-from-a-string/m-p/981158#M649686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to reconstruct a table from a string. Input is as follows. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Comment&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Field1 : [Old]ValueOld[New]ValueNew Field2 : [Old]Dummy Text Old [New]New Dummy Text New Field3 : [Old]Dummy Text Old [New]New Dummy Text New&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wanted ouput:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;FieldName&lt;/TD&gt;&lt;TD&gt;OldValue&lt;/TD&gt;&lt;TD&gt;NewValue&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Field1&lt;/TD&gt;&lt;TD&gt;ValueOld&lt;/TD&gt;&lt;TD&gt;ValueNew&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Field2&lt;/TD&gt;&lt;TD&gt;Dummy Text Old&lt;/TD&gt;&lt;TD&gt;Dummy Text New&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Field3&lt;/TD&gt;&lt;TD&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Dummy Text Old&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Dummy Text New&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;There could be any amount of Fields within a string, however their names are always without spaces&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Stuck a little bit with transformations. Thanks for help!&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2015 13:12:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Parsing-fields-from-a-string/m-p/981158#M649686</guid>
      <dc:creator>yura_ratu</dc:creator>
      <dc:date>2015-09-18T13:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing fields from a string</title>
      <link>https://community.qlik.com/t5/QlikView/Parsing-fields-from-a-string/m-p/981159#M649687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is this Comment-field the definitely format for this string - then in your example is no unique delimiter for the rows? If you have one it would be quite easy to split the string per subfield(string, delimiter) which split the string on the delimiter and repeated the other parts from this record. Quite similar is to use a while-loop whereby iterno() &amp;lt;= substringcount(delimiter). The other string-parts for the old- and new value could be split per subfield(string, delimiter, &lt;STRONG&gt;number&lt;/STRONG&gt;) or textbetween() or maybe some nested mid/left/right- and index-functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think if you haven't such unique delimiter you will need to do it quite similar only that you will need additionally steps within a if-loop where the current record-value with a previous record will be per peek() or previous() compared and the record-values will be adjusted. The worser the datastructure are the more efforts do you need with this comparing, checking and adjusting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe the following links are helpful in understanding what I mean:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/message/722515"&gt;Re: Vertical Data Text in Pivot Table&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/message/830975"&gt;Re: Line adding ETL&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2015 13:41:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Parsing-fields-from-a-string/m-p/981159#M649687</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2015-09-18T13:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing fields from a string</title>
      <link>https://community.qlik.com/t5/QlikView/Parsing-fields-from-a-string/m-p/981160#M649688</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;one solution could be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikCommunity_Thread_181465_Pic1.JPG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/99426_QlikCommunity_Thread_181465_Pic1.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14427097413168503 jive_text_macro" jivemacro_uid="_14427097413168503"&gt;
&lt;P&gt;table1:&lt;/P&gt;
&lt;P&gt;Generic&lt;/P&gt;
&lt;P&gt;LOAD ID,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SubField(SubComment,' : [',1) as FieldName,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TextBetween(SubComment,'[',']',IterNo())&amp;amp;'Value' as ColNam,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TextBetween(SubComment&amp;amp;'[',']','[',IterNo()) as ColVal&lt;/P&gt;
&lt;P&gt;While IterNo() &amp;lt;= SubStringCount(SubComment,'[');&lt;/P&gt;
&lt;P&gt;LOAD ID,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Trim(Mid(Comment, Alt(Previous(Pos)+1,1),RangeSum(Pos,-Previous(Pos)))) as SubComment;&lt;/P&gt;
&lt;P&gt;LOAD *,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(IterNo()=SubStringCount(Comment,' : ['),Len(Comment),Index(Left(Comment,Index(Comment,' : [',IterNo()+1)-1),' ',-1)) as Pos&lt;/P&gt;
&lt;P&gt;INLINE "&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID, Comment&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1, Field1 : [Old]ValueOld[New]ValueNew Field2 : [Old]Dummy Text Old [New]New Dummy Text New Field3 : [Old]Dummy Text Old [New]New Dummy Text New&lt;/P&gt;
&lt;P&gt;"&lt;/P&gt;
&lt;P&gt;While IterNo() &amp;lt;= SubStringCount(Comment,' : [');&lt;/P&gt;
&lt;/PRE&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>Sun, 20 Sep 2015 00:43:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Parsing-fields-from-a-string/m-p/981160#M649688</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2015-09-20T00:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing fields from a string</title>
      <link>https://community.qlik.com/t5/QlikView/Parsing-fields-from-a-string/m-p/981161#M649689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marco,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Works good, thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Sep 2015 09:16:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Parsing-fields-from-a-string/m-p/981161#M649689</guid>
      <dc:creator>yura_ratu</dc:creator>
      <dc:date>2015-09-21T09:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing fields from a string</title>
      <link>https://community.qlik.com/t5/QlikView/Parsing-fields-from-a-string/m-p/981162#M649690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're welcome&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>Mon, 21 Sep 2015 09:38:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Parsing-fields-from-a-string/m-p/981162#M649690</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2015-09-21T09:38:47Z</dc:date>
    </item>
  </channel>
</rss>

