<?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 Data cleansing on existing table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Data-cleansing-on-existing-table/m-p/176296#M44380</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nick,&lt;/P&gt;&lt;P&gt;Obviously it is better to organize the source data better&lt;IMG alt="Geeked" src="http://community.qlik.com/emoticons/emotion-15.gif" /&gt;, but since it is not a perfect world ....&lt;/P&gt;&lt;P&gt;Maybe my suggestion will help you with your problem.&lt;/P&gt;&lt;P&gt;The steps I took: 1: Determine where a new name (could) starts and calculate a potential namegroup index&lt;/P&gt;&lt;P&gt;2; group the table on the namegroup and concatenate the name-strings&lt;/P&gt;&lt;P&gt;3: check against an existing table if the names are valid&lt;/P&gt;&lt;P&gt;In the script it looks like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Temp1:&lt;/P&gt;&lt;P&gt;Load * inline&lt;/P&gt;&lt;P&gt;[x, NameString&lt;/P&gt;&lt;P&gt;1, Entre-&lt;/P&gt;&lt;P&gt;2, os-Rios&lt;/P&gt;&lt;P&gt;3, Albergavia-&lt;/P&gt;&lt;P&gt;4, a-Velha&lt;/P&gt;&lt;P&gt;5, Albergavia-&lt;/P&gt;&lt;P&gt;6, a-Novo&lt;/P&gt;&lt;P&gt;7, Riba-&lt;/P&gt;&lt;P&gt;8, mandego&lt;/P&gt;&lt;P&gt;9, Puebla de&lt;/P&gt;&lt;P&gt;10, Sanabria&lt;/P&gt;&lt;P&gt;11,&lt;/P&gt;&lt;P&gt;12, ert2&lt;/P&gt;&lt;P&gt;13, 1234&lt;/P&gt;&lt;P&gt;14, Vale&lt;/P&gt;&lt;P&gt;15, de Canba&lt;/P&gt;&lt;P&gt;16, Varzea&lt;/P&gt;&lt;P&gt;17, Cova&lt;/P&gt;&lt;P&gt;18, PORTO&lt;/P&gt;&lt;P&gt;19, FARO&lt;/P&gt;&lt;P&gt;20, Moledo do Minho];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Start a new namegroup for all records that start with an Uppercase character.&lt;/P&gt;&lt;P&gt;// this could be any condition of course&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Temp2:&lt;/P&gt;&lt;P&gt;Load *&lt;/P&gt;&lt;P&gt;, NameString &amp;amp; spacing as NameString2;&lt;/P&gt;&lt;P&gt;Load *&lt;/P&gt;&lt;P&gt;, if (Upper(Left(NameString,1)) = Left(NameString,1)&lt;/P&gt;&lt;P&gt;, rangesum(1,peek('namegroup'))&lt;/P&gt;&lt;P&gt;, peek('namegroup') ) as namegroup&lt;/P&gt;&lt;P&gt;, if (right(NameString,1)='-'&lt;/P&gt;&lt;P&gt;, ''&lt;/P&gt;&lt;P&gt;, ' ') as spacing&lt;/P&gt;&lt;P&gt;RESIDENT Temp1&lt;/P&gt;&lt;P&gt;where IsText(NameString);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// group and concat the string&lt;/P&gt;&lt;P&gt;Temp3:&lt;/P&gt;&lt;P&gt;Load namegroup&lt;/P&gt;&lt;P&gt;, Concat(NameString2) as newName&lt;/P&gt;&lt;P&gt;resident Temp2&lt;/P&gt;&lt;P&gt;group by namegroup;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// capitalize if the second character is in uppercase.&lt;/P&gt;&lt;P&gt;// check against another table (if applicable)&lt;/P&gt;&lt;P&gt;Temp4:&lt;/P&gt;&lt;P&gt;Load *&lt;/P&gt;&lt;P&gt;, exists(Name, TheName) as nameFound;&lt;/P&gt;&lt;P&gt;Load namegroup&lt;/P&gt;&lt;P&gt;, if (Upper(Mid(newName,2,1)) = Mid(newName,2,1)&lt;/P&gt;&lt;P&gt;, Capitalize(newName)&lt;/P&gt;&lt;P&gt;, newName) as TheName&lt;/P&gt;&lt;P&gt;resident Temp3;&lt;/P&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Good Luck,&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Regards, Jan&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 05 Dec 2009 16:57:11 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-12-05T16:57:11Z</dc:date>
    <item>
      <title>Data cleansing on existing table</title>
      <link>https://community.qlik.com/t5/QlikView/Data-cleansing-on-existing-table/m-p/176295#M44379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;I've got a problem with creating new data based on existing.&lt;/P&gt;&lt;P&gt;There is a Excel file with just two columns (No and Name):&lt;/P&gt;&lt;P&gt;No, Name&lt;BR /&gt; 1, Entre-&lt;BR /&gt; 2, os-Rios&lt;BR /&gt; 3, Albergavia-&lt;BR /&gt; 4, a-Velha&lt;BR /&gt; 5, Albergavia-&lt;BR /&gt; 6, a-Novo&lt;BR /&gt; 7, Riba-&lt;BR /&gt; 8, mandego&lt;BR /&gt; 9, Puebla de&lt;BR /&gt; 10, Sanabria&lt;BR /&gt; 11,&lt;BR /&gt; 12, ert2&lt;BR /&gt; 13, 1234&lt;BR /&gt; 14, Vale&lt;BR /&gt; 15, de Canba&lt;BR /&gt; 16, Varzea&lt;BR /&gt; 17, Cova&lt;BR /&gt; 18, PORTO&lt;BR /&gt; 19, FARO&lt;BR /&gt; 20, Moledo do Minho&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result should look like..&lt;/P&gt;&lt;P&gt;Nr, Name&lt;BR /&gt; 1, Entre-os-Rios&lt;BR /&gt; 2, Albergavia-a-Velha&lt;BR /&gt; 3, Albergavia-a-Novo&lt;BR /&gt; 4, Ribamandego&lt;BR /&gt; 5, Puebla de Sanabria&lt;BR /&gt; 6, Vale de Canba&lt;BR /&gt; 7, Varzea Cova&lt;BR /&gt; 8, Porto&lt;BR /&gt; 9, Faro&lt;BR /&gt; 10, Moledo do Minho&lt;/P&gt;&lt;P&gt;Any idea how to accomplish this in QV?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nick&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Dec 2009 04:53:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-cleansing-on-existing-table/m-p/176295#M44379</guid>
      <dc:creator />
      <dc:date>2009-12-05T04:53:20Z</dc:date>
    </item>
    <item>
      <title>Data cleansing on existing table</title>
      <link>https://community.qlik.com/t5/QlikView/Data-cleansing-on-existing-table/m-p/176296#M44380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nick,&lt;/P&gt;&lt;P&gt;Obviously it is better to organize the source data better&lt;IMG alt="Geeked" src="http://community.qlik.com/emoticons/emotion-15.gif" /&gt;, but since it is not a perfect world ....&lt;/P&gt;&lt;P&gt;Maybe my suggestion will help you with your problem.&lt;/P&gt;&lt;P&gt;The steps I took: 1: Determine where a new name (could) starts and calculate a potential namegroup index&lt;/P&gt;&lt;P&gt;2; group the table on the namegroup and concatenate the name-strings&lt;/P&gt;&lt;P&gt;3: check against an existing table if the names are valid&lt;/P&gt;&lt;P&gt;In the script it looks like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Temp1:&lt;/P&gt;&lt;P&gt;Load * inline&lt;/P&gt;&lt;P&gt;[x, NameString&lt;/P&gt;&lt;P&gt;1, Entre-&lt;/P&gt;&lt;P&gt;2, os-Rios&lt;/P&gt;&lt;P&gt;3, Albergavia-&lt;/P&gt;&lt;P&gt;4, a-Velha&lt;/P&gt;&lt;P&gt;5, Albergavia-&lt;/P&gt;&lt;P&gt;6, a-Novo&lt;/P&gt;&lt;P&gt;7, Riba-&lt;/P&gt;&lt;P&gt;8, mandego&lt;/P&gt;&lt;P&gt;9, Puebla de&lt;/P&gt;&lt;P&gt;10, Sanabria&lt;/P&gt;&lt;P&gt;11,&lt;/P&gt;&lt;P&gt;12, ert2&lt;/P&gt;&lt;P&gt;13, 1234&lt;/P&gt;&lt;P&gt;14, Vale&lt;/P&gt;&lt;P&gt;15, de Canba&lt;/P&gt;&lt;P&gt;16, Varzea&lt;/P&gt;&lt;P&gt;17, Cova&lt;/P&gt;&lt;P&gt;18, PORTO&lt;/P&gt;&lt;P&gt;19, FARO&lt;/P&gt;&lt;P&gt;20, Moledo do Minho];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Start a new namegroup for all records that start with an Uppercase character.&lt;/P&gt;&lt;P&gt;// this could be any condition of course&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Temp2:&lt;/P&gt;&lt;P&gt;Load *&lt;/P&gt;&lt;P&gt;, NameString &amp;amp; spacing as NameString2;&lt;/P&gt;&lt;P&gt;Load *&lt;/P&gt;&lt;P&gt;, if (Upper(Left(NameString,1)) = Left(NameString,1)&lt;/P&gt;&lt;P&gt;, rangesum(1,peek('namegroup'))&lt;/P&gt;&lt;P&gt;, peek('namegroup') ) as namegroup&lt;/P&gt;&lt;P&gt;, if (right(NameString,1)='-'&lt;/P&gt;&lt;P&gt;, ''&lt;/P&gt;&lt;P&gt;, ' ') as spacing&lt;/P&gt;&lt;P&gt;RESIDENT Temp1&lt;/P&gt;&lt;P&gt;where IsText(NameString);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// group and concat the string&lt;/P&gt;&lt;P&gt;Temp3:&lt;/P&gt;&lt;P&gt;Load namegroup&lt;/P&gt;&lt;P&gt;, Concat(NameString2) as newName&lt;/P&gt;&lt;P&gt;resident Temp2&lt;/P&gt;&lt;P&gt;group by namegroup;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// capitalize if the second character is in uppercase.&lt;/P&gt;&lt;P&gt;// check against another table (if applicable)&lt;/P&gt;&lt;P&gt;Temp4:&lt;/P&gt;&lt;P&gt;Load *&lt;/P&gt;&lt;P&gt;, exists(Name, TheName) as nameFound;&lt;/P&gt;&lt;P&gt;Load namegroup&lt;/P&gt;&lt;P&gt;, if (Upper(Mid(newName,2,1)) = Mid(newName,2,1)&lt;/P&gt;&lt;P&gt;, Capitalize(newName)&lt;/P&gt;&lt;P&gt;, newName) as TheName&lt;/P&gt;&lt;P&gt;resident Temp3;&lt;/P&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Good Luck,&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Regards, Jan&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Dec 2009 16:57:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-cleansing-on-existing-table/m-p/176296#M44380</guid>
      <dc:creator />
      <dc:date>2009-12-05T16:57:11Z</dc:date>
    </item>
    <item>
      <title>Data cleansing on existing table</title>
      <link>https://community.qlik.com/t5/QlikView/Data-cleansing-on-existing-table/m-p/176297#M44381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very good solution. This will help!&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;Regards, Nick&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Dec 2009 19:41:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-cleansing-on-existing-table/m-p/176297#M44381</guid>
      <dc:creator />
      <dc:date>2009-12-05T19:41:43Z</dc:date>
    </item>
  </channel>
</rss>

