<?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: Creating Field Based on String of Another Field in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Creating-Field-Based-on-String-of-Another-Field/m-p/1027983#M928824</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks - this is helpful. What should I do if I want to look for my string anywhere within the field? Is there a find function or something like that that searches the entire field for a string?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 20 Mar 2016 11:44:01 GMT</pubDate>
    <dc:creator />
    <dc:date>2016-03-20T11:44:01Z</dc:date>
    <item>
      <title>Creating Field Based on String of Another Field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-Field-Based-on-String-of-Another-Field/m-p/1027981#M928822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would to create a new field in my load script that is based what string is found in another field. I already have a field with values similar to the ones below"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field1:&lt;/P&gt;&lt;P&gt;"Sample: Oth Mtg Lns ($000)"&lt;/P&gt;&lt;P&gt;"Sample2: RE and Oth ($000)"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to create a second field called Type, which depends on what subtring is found in Field1. For instance:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Other Mortgage Loans"&amp;nbsp; if Field1 contains Oth Mtg Lns&lt;/P&gt;&lt;P&gt;"Real Estate and Other" if Field1 contains RE and Oth&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the best way to go about this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-Field-Based-on-String-of-Another-Field/m-p/1027981#M928822</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Field Based on String of Another Field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-Field-Based-on-String-of-Another-Field/m-p/1027982#M928823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Make a mapping table in which you add the strings found in Field1 in the first column and the value that needs to end up in Field2 as second column.&lt;/P&gt;&lt;P&gt;Now make an applyMap referring to this helper table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example of the mapping table:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 18pt;"&gt;Field1ConversionTable:&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 18pt;"&gt;Mapping&lt;/SPAN&gt;&lt;SPAN style="font-size: 18pt;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 18pt;"&gt;LOAD&lt;/STRONG&gt;&lt;SPAN style="font-size: 18pt;"&gt; * &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 18pt;"&gt;INLINE&lt;/SPAN&gt;&lt;SPAN style="font-size: 18pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 18pt;"&gt;[&lt;BR /&gt; F1, F2&lt;BR /&gt; Oth Mtg Lns, Other Mortgage Loans&lt;BR /&gt; RE and Oth, Real Estate and Other&lt;BR /&gt; ]&lt;/SPAN&gt;&lt;SPAN style="font-size: 18pt;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example of the applyMap function:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 18pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 18pt;"&gt;applymap&lt;/SPAN&gt;&lt;SPAN style="font-size: 18pt;"&gt;('Field1ConversionTable', &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 18pt;"&gt;mid&lt;/SPAN&gt;&lt;SPAN style="font-size: 18pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 18pt;"&gt;Field1&lt;/SPAN&gt;&lt;SPAN style="font-size: 18pt;"&gt;, 8, 11), 'Unknown') &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 18pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 18pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 18pt;"&gt;Field2&lt;/SPAN&gt;&lt;SPAN style="font-size: 18pt;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The actual code for the second value in the applyMap function depends on how the content of Field1 actually looks. You might need to play a bit with trim() and other string functions to find the position of the string you need to match against your mapping table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Mar 2016 09:43:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-Field-Based-on-String-of-Another-Field/m-p/1027982#M928823</guid>
      <dc:creator>oknotsen</dc:creator>
      <dc:date>2016-03-20T09:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Field Based on String of Another Field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-Field-Based-on-String-of-Another-Field/m-p/1027983#M928824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks - this is helpful. What should I do if I want to look for my string anywhere within the field? Is there a find function or something like that that searches the entire field for a string?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Mar 2016 11:44:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-Field-Based-on-String-of-Another-Field/m-p/1027983#M928824</guid>
      <dc:creator />
      <dc:date>2016-03-20T11:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Field Based on String of Another Field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-Field-Based-on-String-of-Another-Field/m-p/1027984#M928825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to be able to recognize the string in some way. If you have some set structure / definition, I am sure a function can be found to extract that / make the match.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Btw,&lt;/P&gt;&lt;P&gt;If you consider a post helpful, you can flag it at such (via actions).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Mar 2016 15:33:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-Field-Based-on-String-of-Another-Field/m-p/1027984#M928825</guid>
      <dc:creator>oknotsen</dc:creator>
      <dc:date>2016-03-20T15:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Field Based on String of Another Field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-Field-Based-on-String-of-Another-Field/m-p/1027985#M928826</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_210150_Pic1.JPG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/118704_QlikCommunity_Thread_210150_Pic1.JPG" style="height: auto; width: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14584950009069727" jivemacro_uid="_14584950009069727"&gt;
&lt;P&gt;LET vSubStrDel = Hash128(Rand());&amp;nbsp; //substring delimiter unlikely to occur in source data&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;mapType:&lt;/P&gt;
&lt;P&gt;Mapping&lt;/P&gt;
&lt;P&gt;LOAD in,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '$(vSubStrDel)'&amp;amp;out&amp;amp;'$(vSubStrDel)'&lt;/P&gt;
&lt;P&gt;Inline [&lt;/P&gt;
&lt;P&gt;in, out&lt;/P&gt;
&lt;P&gt;Oth Mtg Lns,Other Mortgage Loans&lt;/P&gt;
&lt;P&gt;RE and Oth,Real Estate and Other&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;table1:&lt;/P&gt;
&lt;P&gt;LOAD *,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TextBetween(MapSubString('mapType',Field1),'$(vSubStrDel)','$(vSubStrDel)') as Type&lt;/P&gt;
&lt;P&gt;Inline [&lt;/P&gt;
&lt;P&gt;Field1&lt;/P&gt;
&lt;P&gt;Sample: Oth Mtg Lns ($000)&lt;/P&gt;
&lt;P&gt;Sample2: RE and Oth ($000)&lt;/P&gt;
&lt;P&gt;];&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 Mar 2016 17:31:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-Field-Based-on-String-of-Another-Field/m-p/1027985#M928826</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2016-03-20T17:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Field Based on String of Another Field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-Field-Based-on-String-of-Another-Field/m-p/1027986#M928827</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;You are concatenating the out with a Rand and then taking the text in between it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I understand, you are doing this to use MapSubString. Am I right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not, can you please explain you code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any hidden advantage using Hash128? Thank you in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Mar 2016 00:54:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-Field-Based-on-String-of-Another-Field/m-p/1027986#M928827</guid>
      <dc:creator>Saravanan_Desingh</dc:creator>
      <dc:date>2016-03-22T00:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Field Based on String of Another Field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-Field-Based-on-String-of-Another-Field/m-p/1027987#M928828</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'm marking the target string with some random delimiter string to be able to extract it with the TextBetween() function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using a Hash function seemed to be some way to generate a delimiter string that is highly unlikely to occur in any source string. &lt;/P&gt;&lt;P&gt;Second thought, just using &lt;/P&gt;&lt;P&gt;vSubStrDel = 'dh/58d$§&amp;amp;(1=4F24,w:f-4';&lt;/P&gt;&lt;P&gt;should have been random enough&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2016 00:54:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-Field-Based-on-String-of-Another-Field/m-p/1027987#M928828</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2016-03-23T00:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Field Based on String of Another Field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-Field-Based-on-String-of-Another-Field/m-p/1027988#M928829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the explanation, Marco. Nice trick.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created a separate folder for your Apps. Each one is gem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2016 01:10:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-Field-Based-on-String-of-Another-Field/m-p/1027988#M928829</guid>
      <dc:creator>Saravanan_Desingh</dc:creator>
      <dc:date>2016-03-23T01:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Field Based on String of Another Field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-Field-Based-on-String-of-Another-Field/m-p/1027989#M928830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;too much honour ...&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/blush.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2016 01:17:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-Field-Based-on-String-of-Another-Field/m-p/1027989#M928830</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2016-03-23T01:17:13Z</dc:date>
    </item>
  </channel>
</rss>

