<?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: Scrubbing/Cleaning Data when Load in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273118#M1190883</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry about the lack of clarify.&amp;nbsp; I've attached a qvw with sample data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Essentially what I meant was:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any value that leads with (front) needs to be removed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So... in my above example it would have been from (front)code_123 to code_123&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any value that is just (mainstore) to be changed to a null value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any value that ends with (station) to be removed.&amp;nbsp; So, from code_234(station) to code_234&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that makes sense!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Jul 2011 17:45:42 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-07-11T17:45:42Z</dc:date>
    <item>
      <title>Scrubbing/Cleaning Data when Load</title>
      <link>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273116#M1190881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey All-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been scouring the QV discussions and a common theme came up: probably shouldn't use QV for data scrubbing purposes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get this, but unfortunately I'm stuck in a situation where QV is the only means (for right now) of accomplishing this task.&amp;nbsp; That being said, I have one field called CodeName that needs to be scrubbed and cleaned on a weekly basis as it's being loaded into QV.&amp;nbsp; I'd really rather not create a matchtable to do this because the CodeNames are constantly being created (hundreds on a daily basis), so a MatchTable isn't scalable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are the common factors that need to be scrubbed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CodeName&lt;/P&gt;&lt;P&gt;(front)code_123 --&amp;gt; changed to: code_123 &lt;/P&gt;&lt;P&gt;(mainstore)&amp;nbsp; --&amp;gt; changed to: null&lt;/P&gt;&lt;P&gt;code_345(station) --&amp;gt; changed to: code_345&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also...&amp;nbsp; trim functions...&amp;nbsp; I'd like to cover any instance of a leading or trailing space?&amp;nbsp; Do I need to do both (e.g. trim( ' abc') and trim('abc ')?&amp;nbsp; or can I just encompasses everyting under one: trim(' abc ')?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 15:26:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273116#M1190881</guid>
      <dc:creator />
      <dc:date>2011-07-11T15:26:54Z</dc:date>
    </item>
    <item>
      <title>Scrubbing/Cleaning Data when Load</title>
      <link>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273117#M1190882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For the second question, the answer is as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ltrim() will remove leading spaces&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Rtrim() will remove trailing spaces&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Trim() will remove both leading and trailing spaces&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first requirement is not clear. Attach a sample of raw data to be scrubbed along with the desired result after scrubbing for the sample.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 16:22:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273117#M1190882</guid>
      <dc:creator>nagaiank</dc:creator>
      <dc:date>2011-07-11T16:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Scrubbing/Cleaning Data when Load</title>
      <link>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273118#M1190883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry about the lack of clarify.&amp;nbsp; I've attached a qvw with sample data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Essentially what I meant was:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any value that leads with (front) needs to be removed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So... in my above example it would have been from (front)code_123 to code_123&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any value that is just (mainstore) to be changed to a null value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any value that ends with (station) to be removed.&amp;nbsp; So, from code_234(station) to code_234&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that makes sense!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 17:45:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273118#M1190883</guid>
      <dc:creator />
      <dc:date>2011-07-11T17:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Scrubbing/Cleaning Data when Load</title>
      <link>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273119#M1190884</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;Try:&lt;/P&gt;&lt;P&gt; replace(code_codename, '(' &amp;amp; TextBetween(code_codename,'(',')') &amp;amp; ')' ,'') as new_code,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 18:01:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273119#M1190884</guid>
      <dc:creator />
      <dc:date>2011-07-11T18:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Scrubbing/Cleaning Data when Load</title>
      <link>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273120#M1190885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One way of doing this for this type of scrubbing is by using 'Replace' function as shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;Replace(Replace(Replace(code_codename,'(station)',''),'(front)',''),'(mainstore)','') as scrubbed_codename&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the attached qvw file.&lt;/P&gt;&lt;P&gt;You may use the MapSubstring() function also.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 18:03:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273120#M1190885</guid>
      <dc:creator>nagaiank</dc:creator>
      <dc:date>2011-07-11T18:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: Scrubbing/Cleaning Data when Load</title>
      <link>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273121#M1190886</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;Assuming you will have more cases, I'd use a mapping table with the actual values and converted values:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;OldandNewValuesMap:&lt;/P&gt;&lt;P&gt;MAPPING LOAD * INLINE [&lt;/P&gt;&lt;P&gt;Old, New&lt;/P&gt;&lt;P&gt;(front)&lt;/P&gt;&lt;P&gt;(station)&lt;/P&gt;&lt;P&gt;(mainstore)&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MapSubString('OldandNewValuesMap', Field) AS NewField&lt;/P&gt;&lt;P&gt;FROM ...&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, in this case all values are converted to null, so the Replace() function would be fine as well, depending on the number of possible values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/people/mabaeyens" style="font-size: 12px; outline-style: none; padding-top: 1px; padding-bottom: 1px; padding-left: 17px; color: #007fc0; zoom: 1; text-decoration: underline; background-position: no-repeat no-repeat;"&gt;Miguel Angel Baeyens&lt;/A&gt;&lt;/P&gt;&lt;P&gt;BI Consultant&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://www.grupocomex.com/" style="font-size: 12px; outline-style: none; color: #007fc0;"&gt;Comex Grupo Ibérica&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 18:17:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273121#M1190886</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-07-11T18:17:11Z</dc:date>
    </item>
    <item>
      <title>Scrubbing/Cleaning Data when Load</title>
      <link>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273122#M1190887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks everyone! All of these were really helpful. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 19:57:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273122#M1190887</guid>
      <dc:creator />
      <dc:date>2011-07-11T19:57:18Z</dc:date>
    </item>
    <item>
      <title>Scrubbing/Cleaning Data when Load</title>
      <link>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273123#M1190888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As the late &amp;amp; great Peter Falk used to say... "Just one more thing..."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;code_123_4567&lt;/P&gt;&lt;P&gt;code_234_ab35623&lt;/P&gt;&lt;P&gt;code_xxx_0785cat&lt;/P&gt;&lt;P&gt;code_14a_td&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the four (4) examples above, the last underscore '_' and everything after the last underscore needs to be removed. The characters after the last underscore can be varying in length and a mixture of numbers and/or letters.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 20:15:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273123#M1190888</guid>
      <dc:creator />
      <dc:date>2011-07-11T20:15:45Z</dc:date>
    </item>
    <item>
      <title>Scrubbing/Cleaning Data when Load</title>
      <link>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273124#M1190889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(substringcount(raw, '_') &amp;gt; 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;,mid(raw, 1, index(raw, '_', 2)-1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, raw&lt;/P&gt;&lt;P&gt;) as edited&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://robwunderlich.com"&gt;http://robwunderlich.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 20:40:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273124#M1190889</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2011-07-11T20:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: Scrubbing/Cleaning Data when Load</title>
      <link>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273125#M1190890</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;Use the following&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Arial;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;=Left('code_14a_td', Index('code_14a_td', '_', 2) -1) &lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Change the string by the name of your field to get only the expected information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/people/mabaeyens" style="font-size: 12px; outline-style: none; padding-top: 1px; padding-bottom: 1px; padding-left: 17px; color: #007fc0; zoom: 1; text-decoration: underline; background-position: no-repeat no-repeat;"&gt;Miguel Angel Baeyens&lt;/A&gt;&lt;/P&gt;&lt;P&gt;BI Consultant&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://www.grupocomex.com/" style="font-size: 12px; outline-style: none; color: #007fc0;"&gt;Comex Grupo Ibérica&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 20:47:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273125#M1190890</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-07-11T20:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: Scrubbing/Cleaning Data when Load</title>
      <link>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273126#M1190891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have modified the load script to include scrubbing this pattern also. The added line in the script is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If(scrubbed_codename like 'code_???_*',Left(scrubbed_codename,8),scrubbed_codename) as scrubbed_codename&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The modified file is attached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob's suggestion also will work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will have to keep updating your scrubbing script as and when you find the unclean pattern in the data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 20:50:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scrubbing-Cleaning-Data-when-Load/m-p/273126#M1190891</guid>
      <dc:creator>nagaiank</dc:creator>
      <dc:date>2011-07-11T20:50:05Z</dc:date>
    </item>
  </channel>
</rss>

