<?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 change field name with a for loop in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-change-field-name-with-a-for-loop/m-p/493788#M1124511</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 using this from Qlikview Help file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H1&gt;&lt;A name="kanchor824"&gt;&lt;/A&gt;Map ... using&lt;/H1&gt;&lt;P&gt;The &lt;SPAN class="Bold"&gt;map ... using&lt;/SPAN&gt; statement is used for mapping a certain field value or expression to the values of a specific mapping table. The mapping table is created through the &lt;A class="MCXref_0"&gt;&lt;EM&gt;Mapping&lt;/EM&gt;&lt;/A&gt; statement. &lt;/P&gt;&lt;P&gt;The automatic mapping is done for fields loaded after the &lt;SPAN class="Bold"&gt;map ... using&lt;/SPAN&gt; statement until the end of the script or until an &lt;SPAN class="Bold"&gt;unmap&lt;/SPAN&gt; statement is encountered.&lt;/P&gt;&lt;P&gt;The mapping is done last in the chain of events leading up to the field being stored in the internal table in QlikView. This means that mapping is not done every time a field name is encountered as part of an expression, but rather when the value is stored under the field name in the internal table. If mapping on the expression level is required, the &lt;SPAN class="Bold"&gt;Applymap()&lt;/SPAN&gt; function has to be used instead.&lt;/P&gt;&lt;P&gt;The syntax is:&lt;/P&gt;&lt;P class="syntax"&gt;&lt;SPAN class="Bold"&gt;map&lt;/SPAN&gt;&lt;SPAN class="Italic"&gt; *fieldlist &lt;/SPAN&gt;&lt;SPAN class="Bold"&gt;using&lt;/SPAN&gt;&lt;SPAN class="Italic"&gt; mapname&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="Italic"&gt;*fieldlist&lt;/SPAN&gt; is a comma separated list of the fields that should be mapped from this point in the script. Using * as field list indicates all fields. The wildcard characters * and ? are allowed in field names. Quoting of field names may be necessary when wildcards are used.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Italic"&gt;mapname&lt;/SPAN&gt; is the name of a mapping table previously read in a &lt;SPAN class="Bold"&gt;mapping load&lt;/SPAN&gt; or &lt;SPAN class="Bold"&gt;mapping select&lt;/SPAN&gt; statement. &lt;/P&gt;&lt;P class="example"&gt;Examples:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;TABLE cellspacing="0" class="TableStyle-LeftBold" style="margin-right: auto;"&gt;&lt;TBODY&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;&lt;P&gt;map Country using Cmap;&lt;/P&gt;&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;&lt;P&gt;Enables mapping of field Country using map Cmap. &lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;&lt;P&gt;map A, B, C using X;&lt;/P&gt;&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;&lt;P&gt;Enables mapping of fields A, B and C using map X. &lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;&lt;P&gt;map * using GenMap;&lt;/P&gt;&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;&lt;P&gt;Enables mapping of all fields using GenMap.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Jan 2014 10:51:50 GMT</pubDate>
    <dc:creator>jagan</dc:creator>
    <dc:date>2014-01-10T10:51:50Z</dc:date>
    <item>
      <title>How to change field name with a for loop</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-change-field-name-with-a-for-loop/m-p/493787#M1124510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;How can I make this simpler with a for loop? Can I make a loop inside the field name? The fields come from a previously loaded table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: left;"&gt;&lt;SPAN style="color: #000000;"&gt;SecondTable:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;LOAD *,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;if (isnull([test]),0,[data 2013]) as [data 2013 new],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;if (isnull([test]),0,[data bis 2013]) as [data bis 2013 new],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;if (isnull([test]),0,[data 2014])as [data 2014 new],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;if (isnull([test]),0,[data bis 2014]) as [data bis 2014 new],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;if (isnull([test]),0,[data 2015])as [data 2015 new],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;if (isnull([test]),0,[data bis 2015]) as [data bis 2015 new],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;if (isnull([test]),0,[data 2016])as [data 2016 new],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;if (isnull([test]),0,[data bis 2016]) as [data bis 2016 new],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;if (isnull([test]),0,[data 2017])as [data 2017 new],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;if (isnull([test]),0,[data bis 2017]) as [data bis 2017 new],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;if (isnull([test]),0,[data 2018])as [data 2018 new],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;if (isnull([test]),0,[data bis 2018]) as [data bis 2018 new]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: left;"&gt;&lt;SPAN style="color: #000000;"&gt;Resident FirstTable;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;Thanks for your help!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jan 2014 10:43:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-change-field-name-with-a-for-loop/m-p/493787#M1124510</guid>
      <dc:creator />
      <dc:date>2014-01-10T10:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to change field name with a for loop</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-change-field-name-with-a-for-loop/m-p/493788#M1124511</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 using this from Qlikview Help file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H1&gt;&lt;A name="kanchor824"&gt;&lt;/A&gt;Map ... using&lt;/H1&gt;&lt;P&gt;The &lt;SPAN class="Bold"&gt;map ... using&lt;/SPAN&gt; statement is used for mapping a certain field value or expression to the values of a specific mapping table. The mapping table is created through the &lt;A class="MCXref_0"&gt;&lt;EM&gt;Mapping&lt;/EM&gt;&lt;/A&gt; statement. &lt;/P&gt;&lt;P&gt;The automatic mapping is done for fields loaded after the &lt;SPAN class="Bold"&gt;map ... using&lt;/SPAN&gt; statement until the end of the script or until an &lt;SPAN class="Bold"&gt;unmap&lt;/SPAN&gt; statement is encountered.&lt;/P&gt;&lt;P&gt;The mapping is done last in the chain of events leading up to the field being stored in the internal table in QlikView. This means that mapping is not done every time a field name is encountered as part of an expression, but rather when the value is stored under the field name in the internal table. If mapping on the expression level is required, the &lt;SPAN class="Bold"&gt;Applymap()&lt;/SPAN&gt; function has to be used instead.&lt;/P&gt;&lt;P&gt;The syntax is:&lt;/P&gt;&lt;P class="syntax"&gt;&lt;SPAN class="Bold"&gt;map&lt;/SPAN&gt;&lt;SPAN class="Italic"&gt; *fieldlist &lt;/SPAN&gt;&lt;SPAN class="Bold"&gt;using&lt;/SPAN&gt;&lt;SPAN class="Italic"&gt; mapname&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="Italic"&gt;*fieldlist&lt;/SPAN&gt; is a comma separated list of the fields that should be mapped from this point in the script. Using * as field list indicates all fields. The wildcard characters * and ? are allowed in field names. Quoting of field names may be necessary when wildcards are used.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Italic"&gt;mapname&lt;/SPAN&gt; is the name of a mapping table previously read in a &lt;SPAN class="Bold"&gt;mapping load&lt;/SPAN&gt; or &lt;SPAN class="Bold"&gt;mapping select&lt;/SPAN&gt; statement. &lt;/P&gt;&lt;P class="example"&gt;Examples:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;TABLE cellspacing="0" class="TableStyle-LeftBold" style="margin-right: auto;"&gt;&lt;TBODY&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;&lt;P&gt;map Country using Cmap;&lt;/P&gt;&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;&lt;P&gt;Enables mapping of field Country using map Cmap. &lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;&lt;P&gt;map A, B, C using X;&lt;/P&gt;&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;&lt;P&gt;Enables mapping of fields A, B and C using map X. &lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1"&gt;&lt;TD class="BodyE-Column1-Body1"&gt;&lt;P&gt;map * using GenMap;&lt;/P&gt;&lt;/TD&gt;&lt;TD class="BodyD-Column2-Body1"&gt;&lt;P&gt;Enables mapping of all fields using GenMap.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jan 2014 10:51:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-change-field-name-with-a-for-loop/m-p/493788#M1124511</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2014-01-10T10:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to change field name with a for loop</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-change-field-name-with-a-for-loop/m-p/493789#M1124512</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;I think Jagan is thinking of this - which might be what you need:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="Code"&gt;&lt;EM&gt;FieldMap:&lt;/EM&gt;&lt;/P&gt;&lt;P class="Code"&gt;&lt;EM&gt;Mapping SQL SELECT oldnames, newnames FROM datadictionary;&lt;/EM&gt;&lt;/P&gt;&lt;P class="Code"&gt;&lt;EM&gt;Rename fields using FieldMap;&lt;/EM&gt;&lt;/P&gt;&lt;P class="Code"&gt;&lt;/P&gt;&lt;P class="Code"&gt;(also from the manual/help file)&lt;/P&gt;&lt;P class="Code"&gt;&lt;/P&gt;&lt;P class="Code"&gt;HTH&lt;/P&gt;&lt;P class="Code"&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jan 2014 11:00:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-change-field-name-with-a-for-loop/m-p/493789#M1124512</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2014-01-10T11:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to change field name with a for loop</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-change-field-name-with-a-for-loop/m-p/493790#M1124513</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 this, the previous post is for mapping field values.&amp;nbsp; This is for renaming field valus.&amp;nbsp; You can also check this in Qlikview Help file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H3&gt;Using the Rename Fields Statement&lt;/H3&gt;&lt;P&gt;This is a very good method if you want to rename all or some fields at the end of the script run. The best way is to use a mapping table with the old and new field names and use this as follows.&lt;/P&gt;&lt;P class="example"&gt;Example:&lt;/P&gt;&lt;P class="Code"&gt;FieldNameMap;&lt;/P&gt;&lt;P class="Code"&gt;Mapping Load OldFieldName, NewFieldName From FieldNames ;&lt;/P&gt;&lt;P class="Code"&gt;Rename Fields using FieldNameMap;&lt;/P&gt;&lt;P&gt;You can store the mapping table in your database or in an Excel sheet so that it is easier to maintain.&lt;/P&gt;&lt;P&gt;A good solution may be to use a combination of using the &lt;STRONG&gt;as&lt;/STRONG&gt; specifier and using the &lt;STRONG&gt;Rename fields&lt;/STRONG&gt; statement. The &lt;STRONG&gt;as&lt;/STRONG&gt; qualifier is used to define the data model, and the &lt;STRONG&gt;Rename fields&lt;/STRONG&gt; statement to make the fields user-friendly. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jan 2014 11:07:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-change-field-name-with-a-for-loop/m-p/493790#M1124513</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2014-01-10T11:07:47Z</dc:date>
    </item>
  </channel>
</rss>

