<?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: Load Script Loop through table creating new column from value in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Load-Script-Loop-through-table-creating-new-column-from-value/m-p/347948#M128809</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jonathan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I really appreciate you taking the time to provide feedback.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I noticed "FieldName" is actually the name of a script function in Qlikview, so I changed the name of the variable to "ValueOfField".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Additionally I put ' around my use of the variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THolding:&lt;/P&gt;&lt;P&gt; Load &lt;/P&gt;&lt;P&gt;&amp;nbsp; Pol,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Value As '$(ValueofField)'&amp;nbsp; &lt;/P&gt;&lt;P&gt; Resident TTable&lt;/P&gt;&lt;P&gt; Where TypeCat='$(ValueofField)';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Works like a dream.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll tag your response as "Helpful" so you get points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="18262" class="jive-image-thumbnail jive-image" onclick="" alt="Qview Error Fixed.JPG" src="/legacyfs/online/18262_Qview Error Fixed.JPG" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Jul 2012 15:44:38 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-07-12T15:44:38Z</dc:date>
    <item>
      <title>Load Script Loop through table creating new column from value</title>
      <link>https://community.qlik.com/t5/QlikView/Load-Script-Loop-through-table-creating-new-column-from-value/m-p/347944#M128805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Trying to get this to work.&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 _jivemacro_uid_13420978538077450" jivemacro_uid="_13420978538077450"&gt;&lt;P&gt;TTable:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Pol, TypeCat, Value&lt;BR /&gt;1, Cov A, 100,&lt;BR /&gt;1, Cov B, 500,&lt;BR /&gt;1, Cov C, 600,&lt;BR /&gt;1, Cov D, 700,&lt;BR /&gt;1, Form, 2,&lt;BR /&gt;1, Doc, F&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;PMergeTo:&lt;BR /&gt;Load&lt;BR /&gt;Pol&lt;BR /&gt;Resident TTable;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Let RCount=NoOfRows('TTable');&lt;/P&gt;&lt;P&gt;For i=1 to $(RCount)&lt;BR /&gt; Let FieldName=FieldValue('TypeCat',$(i));&lt;BR /&gt; &lt;BR /&gt; THolding:&lt;BR /&gt; Load &lt;BR /&gt;&amp;nbsp; Pol,&lt;BR /&gt;&amp;nbsp; Value As $(FieldName)&amp;nbsp; &lt;BR /&gt; Resident TTable&lt;BR /&gt; Where TypeCat=$(FieldName);&lt;BR /&gt; &lt;BR /&gt; Left JOIN (PMergeTo) LOAD * RESIDENT THolding;&lt;/P&gt;&lt;P&gt; Drop Table THolding; &lt;BR /&gt; &lt;BR /&gt;Next i;&lt;/P&gt;&lt;P&gt;Drop Table TTable;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="18241" class="jive-image" alt="Qview Error.JPG" src="/legacyfs/online/18241_Qview Error.JPG" /&gt;&lt;/P&gt;&lt;P&gt;Getting this error, I must be missing something.&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2012 13:01:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-Script-Loop-through-table-creating-new-column-from-value/m-p/347944#M128805</guid>
      <dc:creator />
      <dc:date>2012-07-12T13:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: Load Script Loop through table creating new column from value</title>
      <link>https://community.qlik.com/t5/QlikView/Load-Script-Loop-through-table-creating-new-column-from-value/m-p/347945#M128806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;...&amp;nbsp; Value As $(FieldName)&amp;nbsp; .... this part of script is wrong&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;each step your column name is different? that's what you want to get?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2012 13:22:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-Script-Loop-through-table-creating-new-column-from-value/m-p/347945#M128806</guid>
      <dc:creator />
      <dc:date>2012-07-12T13:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: Load Script Loop through table creating new column from value</title>
      <link>https://community.qlik.com/t5/QlikView/Load-Script-Loop-through-table-creating-new-column-from-value/m-p/347946#M128807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My goal is to horizontalize the table by the column "Pol", creating a column for each distinct value in "TypeCat" then putting the value from "Value" into it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pol CovA CovB CovC CovD Form Doc&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&amp;nbsp;&amp;nbsp;&amp;nbsp; 500&amp;nbsp;&amp;nbsp; 600&amp;nbsp;&amp;nbsp; 700&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; F&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I was trying to loop through and do 1 column at a time, then join it to the table of Pols.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my non dummy data I have several hundred thousand rows, I want to do it through code because new values of "TypeCat" come into the data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2012 14:30:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-Script-Loop-through-table-creating-new-column-from-value/m-p/347946#M128807</guid>
      <dc:creator />
      <dc:date>2012-07-12T14:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: Load Script Loop through table creating new column from value</title>
      <link>https://community.qlik.com/t5/QlikView/Load-Script-Loop-through-table-creating-new-column-from-value/m-p/347947#M128808</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;Your target field names have spaces in them, so they need to be marked off with []:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class="jive-code"&gt; THolding:&lt;BR /&gt; Load &lt;BR /&gt;&amp;nbsp; Pol,&lt;BR /&gt;&amp;nbsp; Value As [$(FieldName)]&amp;nbsp; &lt;BR /&gt; Resident TTable&lt;BR /&gt; Where TypeCat=[$(FieldName)];&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I see what you are trying to do and it looks like it should work. Some suggestions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;put a DISTINCT in the PMergeTo load statement. Duplicates will cause problems&lt;/LI&gt;&lt;LI&gt;If you loop 1 to NoOfRows(), use Peek('fieldname', i-1, 'tablename') to get the values. Or if you want to use FieldValue('fieldname', i), loop 1 to FieldValueCount(f'ieldname')&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2012 14:52:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-Script-Loop-through-table-creating-new-column-from-value/m-p/347947#M128808</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2012-07-12T14:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: Load Script Loop through table creating new column from value</title>
      <link>https://community.qlik.com/t5/QlikView/Load-Script-Loop-through-table-creating-new-column-from-value/m-p/347948#M128809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jonathan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I really appreciate you taking the time to provide feedback.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I noticed "FieldName" is actually the name of a script function in Qlikview, so I changed the name of the variable to "ValueOfField".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Additionally I put ' around my use of the variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THolding:&lt;/P&gt;&lt;P&gt; Load &lt;/P&gt;&lt;P&gt;&amp;nbsp; Pol,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Value As '$(ValueofField)'&amp;nbsp; &lt;/P&gt;&lt;P&gt; Resident TTable&lt;/P&gt;&lt;P&gt; Where TypeCat='$(ValueofField)';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Works like a dream.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll tag your response as "Helpful" so you get points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="18262" class="jive-image-thumbnail jive-image" onclick="" alt="Qview Error Fixed.JPG" src="/legacyfs/online/18262_Qview Error Fixed.JPG" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2012 15:44:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-Script-Loop-through-table-creating-new-column-from-value/m-p/347948#M128809</guid>
      <dc:creator />
      <dc:date>2012-07-12T15:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: Load Script Loop through table creating new column from value</title>
      <link>https://community.qlik.com/t5/QlikView/Load-Script-Loop-through-table-creating-new-column-from-value/m-p/347949#M128810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P style="background-color: #eef4f9; font-size: 12px; color: #636363; font-family: Arial;"&gt;THolding:&lt;/P&gt;&lt;P style="background-color: #eef4f9; font-size: 12px; color: #636363; font-family: Arial;"&gt;Load&lt;/P&gt;&lt;P style="background-color: #eef4f9; font-size: 12px; color: #636363; font-family: Arial;"&gt;&amp;nbsp; Pol,&lt;/P&gt;&lt;P style="background-color: #eef4f9; font-size: 12px; color: #636363; font-family: Arial;"&gt;&amp;nbsp; &lt;STRONG&gt;Value As $(ValueofField)&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="background-color: #eef4f9; font-size: 12px; color: #636363; font-family: Arial;"&gt;Resident TTable&lt;/P&gt;&lt;P style="background-color: #eef4f9; font-size: 12px; color: #636363; font-family: Arial;"&gt;Where TypeCat='$(ValueofField)';&lt;/P&gt;&lt;P&gt;This is correct one. no need quotes in bold part&lt;/P&gt;&lt;P&gt;because quotes is to tell it as string. for field names no need of it&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2012 20:15:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-Script-Loop-through-table-creating-new-column-from-value/m-p/347949#M128810</guid>
      <dc:creator>CELAMBARASAN</dc:creator>
      <dc:date>2012-07-12T20:15:29Z</dc:date>
    </item>
  </channel>
</rss>

