<?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 Replace part of String in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Replace-part-of-String/m-p/1995723#M1221310</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd like to write an expression where if the fourth character of a string is '1', it is replaced with a 'P'. I'm able to replace the character and keep the expression before the fourth character, but am having trouble keeping the latter half of the string because if there is another '1' later in the string, the subfield portion of the expression picks those up as well. How to get the rest of the text after a certain character? I'm sure there are better ways to accomplish what I wrote. Any improvements are also greatly appreciated. Thank you!&lt;/P&gt;
&lt;P&gt;This is the expression I used and I'm trying to fill in the blank space. I used the subfield expression below to fill in the space but it is not functioning correctly.&lt;/P&gt;
&lt;P&gt;=if(mid([Animal Name], 4,1) = '1', left([Animal Name], 3)&amp;amp;replace(mid([Animal Name], 4,1), '1', 'P'&amp;amp;_______), [Animal Name])&lt;/P&gt;
&lt;P&gt;=subfield([Animal Name], mid([Animal Name], 4, 1), -1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="297"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="159"&gt;
&lt;P&gt;&lt;STRONG&gt;Animal Name&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="139"&gt;
&lt;P&gt;&lt;STRONG&gt;Desired Output&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="159"&gt;
&lt;P&gt;CHI1ABFBW&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="139"&gt;
&lt;P&gt;CHIPABFBW&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="159"&gt;
&lt;P&gt;COWLABFBW&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="139"&gt;
&lt;P&gt;COWLABFBW&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="159"&gt;
&lt;P&gt;PIG12351&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="139"&gt;
&lt;P&gt;PIGP2351&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="159"&gt;
&lt;P&gt;SH11IO1BB&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="139"&gt;
&lt;P&gt;SH1PIO1BB&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="159"&gt;
&lt;P&gt;A111WBI154&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="139"&gt;
&lt;P&gt;A11PWBI154&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
    <pubDate>Fri, 21 Oct 2022 21:02:57 GMT</pubDate>
    <dc:creator>Sara1</dc:creator>
    <dc:date>2022-10-21T21:02:57Z</dc:date>
    <item>
      <title>Replace part of String</title>
      <link>https://community.qlik.com/t5/QlikView/Replace-part-of-String/m-p/1995723#M1221310</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd like to write an expression where if the fourth character of a string is '1', it is replaced with a 'P'. I'm able to replace the character and keep the expression before the fourth character, but am having trouble keeping the latter half of the string because if there is another '1' later in the string, the subfield portion of the expression picks those up as well. How to get the rest of the text after a certain character? I'm sure there are better ways to accomplish what I wrote. Any improvements are also greatly appreciated. Thank you!&lt;/P&gt;
&lt;P&gt;This is the expression I used and I'm trying to fill in the blank space. I used the subfield expression below to fill in the space but it is not functioning correctly.&lt;/P&gt;
&lt;P&gt;=if(mid([Animal Name], 4,1) = '1', left([Animal Name], 3)&amp;amp;replace(mid([Animal Name], 4,1), '1', 'P'&amp;amp;_______), [Animal Name])&lt;/P&gt;
&lt;P&gt;=subfield([Animal Name], mid([Animal Name], 4, 1), -1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="297"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="159"&gt;
&lt;P&gt;&lt;STRONG&gt;Animal Name&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="139"&gt;
&lt;P&gt;&lt;STRONG&gt;Desired Output&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="159"&gt;
&lt;P&gt;CHI1ABFBW&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="139"&gt;
&lt;P&gt;CHIPABFBW&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="159"&gt;
&lt;P&gt;COWLABFBW&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="139"&gt;
&lt;P&gt;COWLABFBW&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="159"&gt;
&lt;P&gt;PIG12351&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="139"&gt;
&lt;P&gt;PIGP2351&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="159"&gt;
&lt;P&gt;SH11IO1BB&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="139"&gt;
&lt;P&gt;SH1PIO1BB&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="159"&gt;
&lt;P&gt;A111WBI154&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="139"&gt;
&lt;P&gt;A11PWBI154&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Fri, 21 Oct 2022 21:02:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Replace-part-of-String/m-p/1995723#M1221310</guid>
      <dc:creator>Sara1</dc:creator>
      <dc:date>2022-10-21T21:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: Replace part of String</title>
      <link>https://community.qlik.com/t5/QlikView/Replace-part-of-String/m-p/1995732#M1221311</link>
      <description>&lt;P&gt;I think this should do the trick:&lt;BR /&gt;=if(mid([Animal Name], 4, 1) = '1', &lt;BR /&gt;left([Animal Name], 3) &amp;amp; 'P' &amp;amp; right([Animal Name], len([Animal Name])-4),&lt;BR /&gt;[Animal Name])&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 23:33:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Replace-part-of-String/m-p/1995732#M1221311</guid>
      <dc:creator>Nicole-Smith</dc:creator>
      <dc:date>2022-10-21T23:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: Replace part of String</title>
      <link>https://community.qlik.com/t5/QlikView/Replace-part-of-String/m-p/1995743#M1221312</link>
      <description>&lt;P&gt;old – old substring you want to replace. new – new substring which would replace the old substring. count – (Optional ) the number of times you want to replace the old substring with the new substring.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.prepaidgiftbalance.vip" target="_self"&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#FFFFFF"&gt;PrepaidGiftBalance Mastercard&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Oct 2022 03:44:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Replace-part-of-String/m-p/1995743#M1221312</guid>
      <dc:creator>jameskenny11</dc:creator>
      <dc:date>2022-10-29T03:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Replace part of String</title>
      <link>https://community.qlik.com/t5/QlikView/Replace-part-of-String/m-p/1995756#M1221313</link>
      <description>&lt;P&gt;another solution might be:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;=If([Animal Name] like '???1*', Left([Animal Name],3)&amp;amp;'P'&amp;amp;Mid([Animal Name],5), [Animal Name])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MarcoWedel_0-1666434299901.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/91939iC68C2CCFA949547E/image-size/large?v=v2&amp;amp;px=999" role="button" title="MarcoWedel_0-1666434299901.png" alt="MarcoWedel_0-1666434299901.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Oct 2022 10:25:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Replace-part-of-String/m-p/1995756#M1221313</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2022-10-22T10:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: Replace part of String</title>
      <link>https://community.qlik.com/t5/QlikView/Replace-part-of-String/m-p/1995781#M1221314</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/155715"&gt;@Sara1&lt;/a&gt;&amp;nbsp; Please see the code below that I have used in the load Editor:&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;BR /&gt;Temp:&lt;BR /&gt;Load * inline [&lt;BR /&gt;Animal Name&lt;BR /&gt;CHI1ABFBW&lt;BR /&gt;COWLABFBW&lt;BR /&gt;PIG12351&lt;BR /&gt;SH11IO1BB&lt;BR /&gt;A111WBI154&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;NoConcatenate&lt;BR /&gt;Temp1:&lt;BR /&gt;Load *,&lt;BR /&gt;if(mid([Animal Name],4,1)='1',&lt;BR /&gt;left([Animal Name],3)&amp;amp;replace(mid([Animal Name],4,1),'1','P')&amp;amp;right([Animal Name],len([Animal Name])-4),&lt;BR /&gt;[Animal Name]) as New_string&lt;BR /&gt;Resident Temp;&lt;BR /&gt;&lt;BR /&gt;Drop table Temp;&lt;/P&gt;
&lt;P&gt;Exit Script;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sidhiq91_0-1666447880415.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/91946i93D4231E8F93DE6A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sidhiq91_0-1666447880415.png" alt="sidhiq91_0-1666447880415.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;IF this resolves your issue, please like and accept it as a solution.&lt;/P&gt;</description>
      <pubDate>Sat, 22 Oct 2022 14:11:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Replace-part-of-String/m-p/1995781#M1221314</guid>
      <dc:creator>sidhiq91</dc:creator>
      <dc:date>2022-10-22T14:11:55Z</dc:date>
    </item>
  </channel>
</rss>

