<?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: Separate string value in three fields in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Separate-string-value-in-three-fields/m-p/1663314#M729933</link>
    <description>&lt;P&gt;Thanks for your reply.I have already found a solution.&lt;BR /&gt;To complete the thread I will give some example Data and the solution which worked for me:&lt;/P&gt;&lt;P&gt;Source:&lt;BR /&gt;Value1 | Value2 | Value3&lt;BR /&gt;Value1 | Value 2|&lt;BR /&gt;Value1&lt;/P&gt;&lt;P&gt;Expectation:&lt;BR /&gt;For Line 1:&lt;BR /&gt;Source1: Value1&lt;BR /&gt;Source2: Value2&lt;BR /&gt;Source3: Value3&lt;/P&gt;&lt;P&gt;For Line 2:&lt;BR /&gt;Source1: Value1&lt;BR /&gt;Source2: Value2&lt;BR /&gt;Source3: empty&lt;/P&gt;&lt;P&gt;For Line 3:&lt;BR /&gt;Source1: Value1&lt;BR /&gt;Source2: empty&lt;BR /&gt;Source:3 empty&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And here is my solution:&lt;BR /&gt;For Field Source 1:&lt;BR /&gt;SubField(Source,'|',1) as Source1,&lt;/P&gt;&lt;P&gt;For Field Source 2:&lt;BR /&gt;SubField(Source,'|',2) as Source2,&lt;/P&gt;&lt;P&gt;For Field Source 3:&lt;BR /&gt;TextBetween(Source,' | ','',2)as Source3,&lt;/P&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;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jan 2020 14:49:03 GMT</pubDate>
    <dc:creator>Fluppie</dc:creator>
    <dc:date>2020-01-07T14:49:03Z</dc:date>
    <item>
      <title>Separate string value in three fields</title>
      <link>https://community.qlik.com/t5/QlikView/Separate-string-value-in-three-fields/m-p/1663302#M729931</link>
      <description>&lt;P&gt;Hi Community,&lt;BR /&gt;I'm confused finding the right commands in my DataModel to separate a data string.&lt;/P&gt;&lt;P&gt;From my Datasource I can load a string which is built up like this:&lt;BR /&gt;(Up to three Vales per line, separeted with a |&amp;nbsp; )&lt;/P&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;'Value1 | Value2 | Value3'&amp;nbsp; or&amp;nbsp;&lt;/P&gt;&lt;P&gt;'Value1 | Value2 ' or&lt;/P&gt;&lt;P&gt;'Value1'&lt;/P&gt;&lt;P&gt;Now I can load this string into a field named Source for example.&lt;BR /&gt;But I also want up to three fields (Source 1-3) which are filled with the values which are separated with |&lt;/P&gt;&lt;P&gt;From my Example above:&lt;/P&gt;&lt;P&gt;Line 1:&lt;BR /&gt;Source1= Value1&lt;BR /&gt;Source2= Value2&lt;BR /&gt;Source3= Value3&lt;/P&gt;&lt;P&gt;Line 2:&lt;BR /&gt;Source1= Value1&lt;BR /&gt;Source2= Value2&lt;BR /&gt;Source3= empty&lt;/P&gt;&lt;P&gt;Line3:&lt;BR /&gt;Source1= Value1&lt;BR /&gt;Source2= empty&lt;BR /&gt;Source3= empty&lt;/P&gt;&lt;P&gt;So, how can I separate this string to get values which can be filled into Source1-3?&lt;BR /&gt;I think the "problem" is, that you can have up to three variants if the fields Source2-3 are filled or not.&lt;/P&gt;&lt;P&gt;Until now I've tried:&lt;/P&gt;&lt;P&gt;SubField(Source,'|',1) as Source1,&lt;BR /&gt;SubField(Source,'|',2) as Source2,&lt;BR /&gt;mid(Source,index(Source,'|',2)+1) as Source3,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works good for example 1 with 3 values to be filled but not 2 and three &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope anybody can give me some advice &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Separate-string-value-in-three-fields/m-p/1663302#M729931</guid>
      <dc:creator>Fluppie</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Separate string value in three fields</title>
      <link>https://community.qlik.com/t5/QlikView/Separate-string-value-in-three-fields/m-p/1663311#M729932</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;can you share a sample DATA for source and output expected ?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2020 14:42:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Separate-string-value-in-three-fields/m-p/1663311#M729932</guid>
      <dc:creator>Taoufiq_Zarra</dc:creator>
      <dc:date>2020-01-07T14:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: Separate string value in three fields</title>
      <link>https://community.qlik.com/t5/QlikView/Separate-string-value-in-three-fields/m-p/1663314#M729933</link>
      <description>&lt;P&gt;Thanks for your reply.I have already found a solution.&lt;BR /&gt;To complete the thread I will give some example Data and the solution which worked for me:&lt;/P&gt;&lt;P&gt;Source:&lt;BR /&gt;Value1 | Value2 | Value3&lt;BR /&gt;Value1 | Value 2|&lt;BR /&gt;Value1&lt;/P&gt;&lt;P&gt;Expectation:&lt;BR /&gt;For Line 1:&lt;BR /&gt;Source1: Value1&lt;BR /&gt;Source2: Value2&lt;BR /&gt;Source3: Value3&lt;/P&gt;&lt;P&gt;For Line 2:&lt;BR /&gt;Source1: Value1&lt;BR /&gt;Source2: Value2&lt;BR /&gt;Source3: empty&lt;/P&gt;&lt;P&gt;For Line 3:&lt;BR /&gt;Source1: Value1&lt;BR /&gt;Source2: empty&lt;BR /&gt;Source:3 empty&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And here is my solution:&lt;BR /&gt;For Field Source 1:&lt;BR /&gt;SubField(Source,'|',1) as Source1,&lt;/P&gt;&lt;P&gt;For Field Source 2:&lt;BR /&gt;SubField(Source,'|',2) as Source2,&lt;/P&gt;&lt;P&gt;For Field Source 3:&lt;BR /&gt;TextBetween(Source,' | ','',2)as Source3,&lt;/P&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2020 14:49:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Separate-string-value-in-three-fields/m-p/1663314#M729933</guid>
      <dc:creator>Fluppie</dc:creator>
      <dc:date>2020-01-07T14:49:03Z</dc:date>
    </item>
  </channel>
</rss>

