<?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: How to do cascading Replace in a set expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770933#M273657</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What happens if you try &lt;SPAN style="color: #3366ff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Replace('(' &amp;amp; Concat({$ + S4} &lt;SPAN style="color: #3366ff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Replace(Replace(&lt;/SPAN&gt;Product&lt;SPAN style="color: #3366ff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;,'(','?'),')','?')&lt;/SPAN&gt;, '|') &amp;amp; ')','&amp;nbsp; ','?')&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Nov 2014 15:17:09 GMT</pubDate>
    <dc:creator>kristoferahlin</dc:creator>
    <dc:date>2014-11-18T15:17:09Z</dc:date>
    <item>
      <title>How to do cascading Replace in a set expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770929#M273653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a set expression that creates a union of two states.&amp;nbsp; The expression must also cover the situation where the data contains a space, a left parentheses, and a right parenthesis.&amp;nbsp; I can make the expression work with a space, but am having trouble extending it.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is an example of what is working:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; &lt;SPAN style="line-height: 1.5em; color: #3366ff; font-size: 11pt; font-family: Calibri;"&gt;Replace('(' &amp;amp; Concat({$ + S4} Product, '|') &amp;amp; ')','&amp;nbsp; ','?') &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;In this case, I am creating a successful union between the default state, and S4, and inserting a pipe character between the entries.&amp;nbsp; I am also replacing any spaces that are found with a question mark.&amp;nbsp; Altogether, this expression takes selections made in one state (S4), and adds them to selections already in place in another state ($).&amp;nbsp; This works perfectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My data also contains a right and left parenthesis.&amp;nbsp; When I try to extend this expression, I am entering:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #3366ff;"&gt;Replace(Replace(Replace('(' &amp;amp; Concat({$ + S4} Product, '|') &amp;amp; ')','&amp;nbsp; ','?'),'(','?'),')','?')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The syntax editor indicates the expression is OK, but it does not work.&amp;nbsp; Specifically, it no longer moves selections between the states.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a debugging step, I've tried putting the below example into a text box.&amp;nbsp; It works perfectly.&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #3366ff;"&gt;Replace(Replace(Replace(Product,' ','?'),'(','?'),')','?')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757;"&gt;When I do this, I get the product names, with spaces and parenthesis replaced by question marks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anybody have any ideas why the middle example does not work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gary&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 14:22:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770929#M273653</guid>
      <dc:creator />
      <dc:date>2014-11-18T14:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to do cascading Replace in a set expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770930#M273654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I haven't test it but i noticed you are adding '(' and ')' in the inner string but then trying to replace ')' and '('.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would this change work for you ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;change&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Replace(Replace(Replace('(' &amp;amp; Concat({$ + S4} Product, '|') &amp;amp; ')','&amp;nbsp; ','?'),'(','?'),')','?')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;to:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;'(' &amp;amp; Replace(Replace(Replace(Concat({$ + S4} Product, '|'),'&amp;nbsp; ','?'),'(','?'),')','?') &amp;amp; ')'&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 14:35:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770930#M273654</guid>
      <dc:creator>JonnyPoole</dc:creator>
      <dc:date>2014-11-18T14:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to do cascading Replace in a set expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770931#M273655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are replacing also the left and right parenthesis within the Concat() statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It might be possible to add $() to first calculate the Concat()-expression, prior to replacing the parenthesis... Not sure about the syntax tho.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively, replace space and parenthesis in Product prior to concatenating the states. Would that be possible?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 14:40:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770931#M273655</guid>
      <dc:creator>kristoferahlin</dc:creator>
      <dc:date>2014-11-18T14:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: Re: How to do cascading Replace in a set expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770932#M273656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried your change, and it seems to still have the same problem:&amp;nbsp; if I add a Product with a name like "Orange", the expression works great.&amp;nbsp; If the name is "Orange Red" the add (union) does not occur, and if the Product has a name like "Orange (all)" it likewise doesn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The full expression this is used in is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #3366ff;"&gt; IF(GetSelectedCount(Product)&amp;gt;0,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Replace('(' &amp;amp; Concat({$ + S4} Product, '|') &amp;amp; ')','&amp;nbsp; ','?'),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Replace('(' &amp;amp; Concat({S4} Product, '|') &amp;amp; ')','&amp;nbsp; ','?')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Above is the "original" form of the expression, which works OK with a space in the Product name.&amp;nbsp; This expression does not work when a right or left parenthesis is present, hence my editing to the alternative form that I wrote about, in my first post.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Note:&amp;nbsp; the IF statement covers the first add, when there is nothing to move.&amp;nbsp; After that, we are moving a new entry into the set that has existing entries.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gary&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 15:07:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770932#M273656</guid>
      <dc:creator />
      <dc:date>2014-11-18T15:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to do cascading Replace in a set expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770933#M273657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What happens if you try &lt;SPAN style="color: #3366ff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Replace('(' &amp;amp; Concat({$ + S4} &lt;SPAN style="color: #3366ff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Replace(Replace(&lt;/SPAN&gt;Product&lt;SPAN style="color: #3366ff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;,'(','?'),')','?')&lt;/SPAN&gt;, '|') &amp;amp; ')','&amp;nbsp; ','?')&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 15:17:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770933#M273657</guid>
      <dc:creator>kristoferahlin</dc:creator>
      <dc:date>2014-11-18T15:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to do cascading Replace in a set expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770934#M273658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've tried Kristofer's idea, and still have the problem.&amp;nbsp; I can add Products having names of all one word.&amp;nbsp; Products that have a space, and products that have parenthesis, are ignored.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The original expression (my first example) does work with spaces, but does not work with parenthesis.&amp;nbsp; Both alternatives (Jonathan's and Kristofer's) result in both spaces and parenthesis not working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the suggestions, any more ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gary&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 16:21:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770934#M273658</guid>
      <dc:creator />
      <dc:date>2014-11-18T16:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: Re: How to do cascading Replace in a set expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770935#M273659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think there will be a way to fix it.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Keep in mind that a search string of values , where the values have spaces need single quotes around all values like this (not just at the ends). So i think you need to modify the delimitted for concat() accordingly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;('United States'|'Canada'|'United Kingdom') &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure about ')' and '(' , but i would suggest testing a sample string directly in the search option of a list box to play with it at first.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Give it a shot and see how both work out... i'll check in later.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 17:32:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770935#M273659</guid>
      <dc:creator>JonnyPoole</dc:creator>
      <dc:date>2014-11-18T17:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to do cascading Replace in a set expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770936#M273660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've created an example file for everyone to play with.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is actually a pretty nice function and, if we can get it working, it might be useful for others. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The idea is that the upper box (Product) contains items that you want to add to the filter.&amp;nbsp; You can pre select an item, or items, then click the "Add" button.&amp;nbsp; The selection(s) are added.&amp;nbsp; Then you can continue by adding more items in the Products box, and press "Add" again.&amp;nbsp; Items that were selected will then be added to the items selected earlier.&amp;nbsp; In the full implementation (not this example) I also have a "Remove" button that takes items off the list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can see the problem in the example file.&amp;nbsp; For example:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Click "Broccoli", then click "Add".&amp;nbsp; Broccoli will be added to the filter, and this can be seen in the lower "Product Results" table.&lt;/LI&gt;&lt;LI&gt;Next, click "Collar", then click "Add".&amp;nbsp; Collar will be added to the results.&lt;/LI&gt;&lt;LI&gt;Next, click "SnowCo (ALL)".&amp;nbsp; This will NOT be added.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can do this any way you want, but the product with he parenthesis will not add.&amp;nbsp; Note that I've got the space condition covered.&amp;nbsp; This can be demonstrated by clicking "Snow Flake"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gary&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 18:12:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770936#M273660</guid>
      <dc:creator />
      <dc:date>2014-11-18T18:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: Re: How to do cascading Replace in a set expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770937#M273661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here it is with () working too....&amp;nbsp; not perfect since we are using a wildcard character '?' to replace space, ( and ) which could technically bring back the wrong results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/71572_Capture.PNG.png" style="width: 620px; height: 308px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 19:42:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770937#M273661</guid>
      <dc:creator>JonnyPoole</dc:creator>
      <dc:date>2014-11-18T19:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: Re: How to do cascading Replace in a set expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770938#M273662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes!!&amp;nbsp; Much dancing around my office ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gary&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 19:56:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770938#M273662</guid>
      <dc:creator />
      <dc:date>2014-11-18T19:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Re: How to do cascading Replace in a set expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770939#M273663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One more update to add... removed the wildcard and now it works 'as is' with spaces and parentheses&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The trick is to build the search string with double quotes around the values (NOT single quotes like i originally mentioned above)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IE:&amp;nbsp; ("Asia","North America","All()")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 20:16:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-do-cascading-Replace-in-a-set-expression/m-p/770939#M273663</guid>
      <dc:creator>JonnyPoole</dc:creator>
      <dc:date>2014-11-18T20:16:32Z</dc:date>
    </item>
  </channel>
</rss>

