<?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: Rename all fields programmatically from each table in script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1666530#M594864</link>
    <description>&lt;P&gt;Because RENAME does not allow you to limit to table, I think you will have to do something along the lines of what&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/336"&gt;@Kushal_Chawda&lt;/a&gt;&amp;nbsp;is proposing.&amp;nbsp; Alias or Qualify at least the common fields up front -- or through an additional load.&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;</description>
    <pubDate>Fri, 17 Jan 2020 01:39:17 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2020-01-17T01:39:17Z</dc:date>
    <item>
      <title>Rename all fields programmatically from each table in script</title>
      <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1664527#M594850</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;What is the best way to rename programmatically all fields in a given table with a "xx_" prefix related to the table name (but not the table name itself - and therefore not an alias or QUALIFY statement)?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2020 15:54:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1664527#M594850</guid>
      <dc:creator>kmstephenson</dc:creator>
      <dc:date>2020-01-10T15:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: Rename all fields programmatically from each table in script</title>
      <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1664532#M594851</link>
      <description>&lt;P&gt;What is the use case to do so? Can you please provide example?&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2020 15:59:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1664532#M594851</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-01-10T15:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: Rename all fields programmatically from each table in script</title>
      <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1664534#M594852</link>
      <description>&lt;P&gt;For a data exploration application, our end users want to be able to identify which table a field is coming from (given field names are replicated across tables at different levels). I don't want to use QUALIFY because the table names are long and I'd like this to be a part of the field name itself.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2020 16:07:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1664534#M594852</guid>
      <dc:creator>kmstephenson</dc:creator>
      <dc:date>2020-01-10T16:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: Rename all fields programmatically from each table in script</title>
      <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1664574#M594853</link>
      <description>&lt;P&gt;This loop will do what you ask.&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;For&lt;/SPAN&gt; tableIdx = 0 &lt;SPAN class="s1"&gt;to&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;NoOfTables&lt;/SPAN&gt;() - 1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;&amp;nbsp; Let&lt;/SPAN&gt; vTableName = &lt;SPAN class="s1"&gt;TableName&lt;/SPAN&gt;(&lt;SPAN class="s2"&gt;&lt;I&gt;$(tableIdx)&lt;/I&gt;&lt;/SPAN&gt;);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;&amp;nbsp; Let&lt;/SPAN&gt; vPrefix = &lt;SPAN class="s1"&gt;left&lt;/SPAN&gt;('$(vTableName)', 2) &amp;amp; '_';&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;&amp;nbsp; For&lt;/SPAN&gt; fieldIdx = 1 &lt;SPAN class="s1"&gt;to&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;NoOfFields&lt;/SPAN&gt;('$(vTableName)')&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;&amp;nbsp; &amp;nbsp; LET&lt;/SPAN&gt; vFieldname = &lt;SPAN class="s1"&gt;FieldName&lt;/SPAN&gt;(&lt;SPAN class="s2"&gt;&lt;I&gt;$(fieldIdx)&lt;/I&gt;&lt;/SPAN&gt;, '$(vTableName)');&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;&amp;nbsp; &amp;nbsp; RENAME&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;Field&lt;/SPAN&gt; &lt;SPAN class="s3"&gt;[$(vFieldname)]&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;TO&lt;/SPAN&gt; &lt;SPAN class="s3"&gt;[$(vPrefix)$(vFieldname)]&lt;/SPAN&gt;;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;&amp;nbsp; Next&lt;/SPAN&gt; fieldIdx&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;Next&lt;/SPAN&gt; tableIdx&lt;/FONT&gt;&lt;/P&gt;&lt;P class="p1"&gt;But it will make the key names constant -- with multiple prefixes.&amp;nbsp; Is that what you want or do you need to break the links?&lt;/P&gt;&lt;P class="p1"&gt;-Rob&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2020 19:35:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1664574#M594853</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2020-01-10T19:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: Rename all fields programmatically from each table in script</title>
      <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1664602#M594854</link>
      <description>&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;I would like to break the links for all but the key fields. Is it possible to do a loop just for the renames needed within each separate table?&lt;/P&gt;&lt;P&gt;E.g.&lt;/P&gt;&lt;P&gt;TableABC:&lt;/P&gt;&lt;P&gt;LOAD Key1,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Key2,&lt;/P&gt;&lt;P&gt;[INSERT LOOP]&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;XX_&lt;/STRONG&gt;VARNAME1,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; XX_VARNAME2,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note, the &lt;STRONG&gt;XX_&amp;nbsp;&lt;/STRONG&gt;prefix will be assigned by me at a table level - it will not be the first two characters of the actual table name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2020 20:37:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1664602#M594854</guid>
      <dc:creator>kmstephenson</dc:creator>
      <dc:date>2020-01-10T20:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: Rename all fields programmatically from each table in script</title>
      <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1664606#M594855</link>
      <description>&lt;P&gt;If you want to provide the table prefix of our choice then I have slightly modified what&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/6148"&gt;@rwunderlich&lt;/a&gt;&amp;nbsp; has suggested.&lt;/P&gt;&lt;P&gt;You need to manually defined the Key field in wildmatch condition to break links&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Let's assume you have below 3 tables

TableA:
LOAD * Inline [
ID,Sales
1,100
2,200 ];

TableB:
LOAD * Inline [
ID,Name
1,a
2,b ];

TableC:
LOAD * Inline [
ID,Order
1,11
2,22 ];&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;for i=0 to NoOfTables()-1

let vTableName = TableName($(i));

Table: // define prefix for each table. Make sure that Table name should match
LOAD * Inline [
TableName,TablePrefix
TableA,A
TableB,B
TableC,C ];

TablePrefix:
LOAD TablePrefix&amp;amp;'_' as TablePrefix
Resident Table
Where TableName='$(vTableName)';

LET vTablePrefix = Peek('TablePrefix',0,'TablePrefix');

for j=1 to NoOfFields('$(vTableName)')

let vFieldName = FieldName($(j),'$(vTableName)');

let vMatch = not wildmatch('$(vFieldName)','*ID*'); // check key field condition. Do not rename to key field

if '$(vMatch)' = -1 then

RENAME Field [$(vFieldName)] to [$(vTablePrefix)$(vFieldName)];

ENDIF

next

DROP Table TablePrefix;

next

DROP Table Table;&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 10 Jan 2020 21:08:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1664606#M594855</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-01-10T21:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: Rename all fields programmatically from each table in script</title>
      <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1664616#M594856</link>
      <description>&lt;P&gt;another approach&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;for i=0 to NoOfTables()-1

let vTableName = TableName($(i));

for j=1 to NoOfFields('$(vTableName)')

let vFieldName = FieldName($(j),'$(vTableName)');

Fields:
LOAD '$(vTableName)' as TableName,
     '$(vFieldName)' as FieldName
AutoGenerate 1;

next

next

Left Join(Fields) 
// define prefix for each table. Make sure that Table name should match
LOAD * Inline [
TableName,TablePrefix
TableA,A
TableB,B
TableC,C ];

//Difine the fields which you don't want to Rename
NoRename:
LOAD Concat(DISTINCT chr(39)&amp;amp;Fields&amp;amp;chr(39),',') as NoRename_Fields;
LOAD * Inline [
Fields
ID
Order2 ];

let vNoRenameFields = Peek('NoRename_Fields',0,'NoRename');

Map_RenameFields:
mapping LOAD FieldName as RenameFrom,
     TablePrefix&amp;amp;'_'&amp;amp;FieldName as RenameTo
Resident Fields
where not match(FieldName,$(vNoRenameFields));

RENAME Fields using Map_RenameFields;

DROP Tables Fields,NoRename;&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 10 Jan 2020 21:28:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1664616#M594856</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-01-10T21:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: Rename all fields programmatically from each table in script</title>
      <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1664627#M594857</link>
      <description>&lt;P&gt;This is very close - only problem is that some of the fields with the same field names across tables are keys and others are not keys and should be named with the table prefix. It looks like the RENAME statement is working for the links/keys between table (as these are individually listed in the load * inline to be excluded). However, for duplicate field names across tables that are not keys, it looks like these are all being renamed with the table prefix of the first table loaded with these variables. Does that make sense? How do I fix this?&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2020 22:26:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1664627#M594857</guid>
      <dc:creator>kmstephenson</dc:creator>
      <dc:date>2020-01-10T22:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: Rename all fields programmatically from each table in script</title>
      <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1664632#M594858</link>
      <description>&lt;P&gt;Understood your point and that is why Qlik has &lt;STRONG&gt;Qualify&amp;nbsp;&lt;/STRONG&gt;concepts. Using Qualify you can easily rename the fields (Just change the table name to prefix you want). This is the only drawback of dynamic renaming that Rename field fucntion does not refer to table&amp;nbsp; Unfortunately we can't do like&amp;nbsp;&lt;STRONG&gt;Rename field ID to A_ID where Tablename 'A'&amp;nbsp;&lt;/STRONG&gt;&amp;nbsp; otherwise your query would have solved now.&lt;/P&gt;&lt;P&gt;In your case common field names which are not key, you need to alias them manually and add those renamed field to mapping table so that Dynamic rename function will not rename that field again.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Here, Order is common between TableB &amp;amp; TableC which you want to rename
TableA:
LOAD * Inline [
ID,Sales
1,100
2,200 ];

ALIAS Order as B_Order;
TableB:
LOAD * Inline [
ID,Name,Order
1,a,12
2,b ,13];

ALIAS Order as C_Order;
TableC:
LOAD * Inline [
ID,Order,Order2
1,11,111
2,22,111 ];&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;for i=0 to NoOfTables()-1

let vTableName = TableName($(i));


for j=1 to NoOfFields('$(vTableName)')

let vFieldName = FieldName($(j),'$(vTableName)');

Fields:
LOAD '$(vTableName)' as TableName,
     '$(vFieldName)' as FieldName
AutoGenerate 1;

next

next

Left Join(Fields) 
// define prefix for each table. Make sure that Table name should match
LOAD * Inline [
TableName,TablePrefix
TableA,A
TableB,B
TableC,C ];

//Difine the fields which you don't want to Rename and already renamed via alias keyword
NoRename:
LOAD Concat(DISTINCT chr(39)&amp;amp;Fields&amp;amp;chr(39),',') as NoRename_Fields;
LOAD * Inline [
Fields
ID
Order2
B_Order
C_Order ];

let vNoRenameFields = Peek('NoRename_Fields',0,'NoRename');

Map_RenameFields:
mapping LOAD FieldName as RenameFrom,
     TablePrefix&amp;amp;'_'&amp;amp;FieldName as RenameTo
Resident Fields
where not match(FieldName,$(vNoRenameFields));

RENAME Fields using Map_RenameFields;

DROP Tables Fields,NoRename;&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 10 Jan 2020 23:16:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1664632#M594858</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-01-10T23:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: Rename all fields programmatically from each table in script</title>
      <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1664633#M594859</link>
      <description>&lt;P&gt;I can suggest some code changes as Kush has, but let me take a step back and ask a couple questions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Why not name the tables with the short name you want and use QUALIFY * and UNQUALIFY for the keys?&lt;/P&gt;&lt;P&gt;2. If the goal is for the user to understand what table a field is in, can they do that with $Field and $Table?&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2020 23:31:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1664633#M594859</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2020-01-10T23:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: Rename all fields programmatically from each table in script</title>
      <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1665913#M594860</link>
      <description>&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;The answers to your questions are primarily table and variable naming standards within the organization. QUALIFY isn't used in production applications (fields are just renamed when necessary) so the primary goal is to continue to align within standards but programmatically rename all required fields with the desired prefix. Most scenarios we work with don't include duplicate field names across tables, so this data model is unique in that sense for us.&lt;/P&gt;&lt;P&gt;Thanks for your help with this!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2020 17:13:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1665913#M594860</guid>
      <dc:creator>kmstephenson</dc:creator>
      <dc:date>2020-01-15T17:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: Rename all fields programmatically from each table in script</title>
      <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1665984#M594861</link>
      <description>&lt;P&gt;Here'a another version that let's you specify keys to exclude and specific table prefixes:&lt;/P&gt;&lt;P class="p1"&gt;&lt;FONT face="courier new,courier"&gt;TempKeys:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;LOAD&lt;/SPAN&gt; * &lt;SPAN class="s1"&gt;Inline&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;[&lt;BR /&gt;Key&lt;BR /&gt;Num&lt;BR /&gt;]&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;TablePrefixMap:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;Mapping&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;LOAD&lt;/SPAN&gt; * &lt;SPAN class="s1"&gt;Inline&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;[&lt;BR /&gt;Name, Prefix&lt;BR /&gt;Transactions, TR_&lt;BR /&gt;Characters, DI3_&lt;BR /&gt;ASCII, II-&lt;BR /&gt;]&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;For&lt;/SPAN&gt; tableIdx = 0 &lt;SPAN class="s1"&gt;to&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;NoOfTables&lt;/SPAN&gt;() - 2&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;&amp;nbsp; Let&lt;/SPAN&gt; vTableName = &lt;SPAN class="s1"&gt;TableName&lt;/SPAN&gt;(&lt;SPAN class="s3"&gt;&lt;I&gt;$(tableIdx)&lt;/I&gt;&lt;/SPAN&gt;);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;&amp;nbsp; For&lt;/SPAN&gt; fieldIdx = 1 &lt;SPAN class="s1"&gt;to&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;NoOfFields&lt;/SPAN&gt;('$(vTableName)')&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;&amp;nbsp; &amp;nbsp; LET&lt;/SPAN&gt; vFieldname = &lt;SPAN class="s1"&gt;FieldName&lt;/SPAN&gt;(&lt;SPAN class="s3"&gt;&lt;I&gt;$(fieldIdx)&lt;/I&gt;&lt;/SPAN&gt;, '$(vTableName)');&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; TempRenameMap:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;&amp;nbsp; &amp;nbsp; Load&lt;/SPAN&gt; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; '$(vFieldname)' &lt;SPAN class="s1"&gt;as&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;oldname&lt;/SPAN&gt;,&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ApplyMap&lt;/SPAN&gt;('TablePrefixMap','$(vTableName)', '') &amp;amp; '$(vFieldname)' &lt;SPAN class="s1"&gt;as&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;newname&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;&amp;nbsp; &amp;nbsp; AutoGenerate&lt;/SPAN&gt; 1 &lt;SPAN class="s1"&gt;where&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;not&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;Exists&lt;/SPAN&gt;(&lt;SPAN class="s2"&gt;Key&lt;/SPAN&gt;, '$(vFieldname)');&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;&amp;nbsp; Next&lt;/SPAN&gt; fieldIdx&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;Next&lt;/SPAN&gt; tableIdx&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;RenameMap:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;Mapping&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;LOAD&lt;/SPAN&gt; * &lt;SPAN class="s1"&gt;Resident&lt;/SPAN&gt; TempRenameMap;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;RENAME&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;Fields&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;Using&lt;/SPAN&gt; RenameMap;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="s1"&gt;Drop&lt;/SPAN&gt; &lt;SPAN class="s1"&gt;Table&lt;/SPAN&gt; TempKeys, TempRenameMap;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="p1"&gt;-Rob&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2020 21:08:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1665984#M594861</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2020-01-15T21:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: Rename all fields programmatically from each table in script</title>
      <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1666296#M594862</link>
      <description>&lt;P&gt;Thanks Rob, this too is very helpful. Is there any way to programmatically generate a list of synthetic keys (e.g. list of fields used in more than one table) ?&amp;nbsp; Currently, the logic below works well for the unique field names and if the keys/duplicate field names are renamed prior to those steps and added onto TempKeys. &lt;SPAN&gt;I'm trying to remove all manual steps - such as identifying which fields have duplicate table names across tables (some of these are keys and others need to be renamed) as I would like this logic to be able to be implemented for our projects as well.&lt;/SPAN&gt; Thanks!!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 14:43:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1666296#M594862</guid>
      <dc:creator>kmstephenson</dc:creator>
      <dc:date>2020-01-16T14:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: Rename all fields programmatically from each table in script</title>
      <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1666337#M594863</link>
      <description>&lt;P&gt;Did you tried what I suggested for this?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 15:31:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1666337#M594863</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-01-16T15:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: Rename all fields programmatically from each table in script</title>
      <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1666530#M594864</link>
      <description>&lt;P&gt;Because RENAME does not allow you to limit to table, I think you will have to do something along the lines of what&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/336"&gt;@Kushal_Chawda&lt;/a&gt;&amp;nbsp;is proposing.&amp;nbsp; Alias or Qualify at least the common fields up front -- or through an additional load.&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 01:39:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1666530#M594864</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2020-01-17T01:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: Rename all fields programmatically from each table in script</title>
      <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1666800#M594865</link>
      <description>&lt;P&gt;So I did try a combination of ALIAS or renaming those duplicate fields prior and then excluding those from the rename process. Is there any way to programmatically generate that list of duplicate field names across tables so that the dashboard developer is aware of which fields need to be addressed? For example, is there a WHERE clause on the below that I could use to check for field names duplicated? Thanks so much!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;for i=0 to NoOfTables()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//DO NOT CHANGE&lt;BR /&gt;let vTableNameCheckDups = TableName($(i));&lt;BR /&gt;for j=1 to NoOfFields('$(vTableNameCheckDups)')&lt;BR /&gt;let vFieldNameCheckDups = FieldName($(j),'$(vTableNameCheckDups)');&lt;BR /&gt;TempCheckDups:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;LOAD '$(vFieldNameCheckDups)' as CheckDups&lt;BR /&gt;AutoGenerate 1;&lt;BR /&gt;next&lt;BR /&gt;next&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 15:14:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1666800#M594865</guid>
      <dc:creator>kmstephenson</dc:creator>
      <dc:date>2020-01-17T15:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: Rename all fields programmatically from each table in script</title>
      <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1674164#M594866</link>
      <description>&lt;P&gt;Going way out on a limb on this one, Rob may laugh at me, but have a look at the following Design Blog post, may be the piece you need to get things more automated, but I am not sure, Rob generally covers all the avenues, so not really sure on this one.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/Preceding-Load/ba-p/1469534" target="_blank"&gt;https://community.qlik.com/t5/Qlik-Design-Blog/Preceding-Load/ba-p/1469534&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Brett&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 22:04:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1674164#M594866</guid>
      <dc:creator>Brett_Bleess</dc:creator>
      <dc:date>2020-02-10T22:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: Rename all fields programmatically from each table in script</title>
      <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1762998#M594867</link>
      <description>&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;I tried to reuse your code for replacing all blank spaces between field names. For example:&lt;/P&gt;&lt;P&gt;"xxx xx"&lt;/P&gt;&lt;P&gt;"xxxx xxx"&lt;/P&gt;&lt;P&gt;all my field names have blank spaces.&lt;/P&gt;&lt;P&gt;I modified the code as follows but it did not work:&lt;/P&gt;&lt;P&gt;For fieldIdx = 1 to NoOfFields('TempTable')&lt;BR /&gt;LET vFieldname =FieldName($(fieldIdx), 'TempTable');&lt;BR /&gt;LET vFieldnameModified =Replace(FieldName($(fieldIdx), 'TempTable'),' ','_');&lt;BR /&gt;RENAME Field [$(vFieldname)] TO $(vFieldnameModified);&lt;BR /&gt;Next fieldIdx&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;however line 3 is not working, because it is not replacing the blank spaces,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 16:18:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1762998#M594867</guid>
      <dc:creator>Zaga_69</dc:creator>
      <dc:date>2020-11-19T16:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Rename all fields programmatically from each table in script</title>
      <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1763003#M594868</link>
      <description>&lt;P&gt;even by doing the following modification, it is not working&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For fieldIdx = 1 to NoOfFields('TempTable')&lt;BR /&gt;LET vFieldname =FieldName($(fieldIdx), 'TempTable');&lt;BR /&gt;LET vFieldnameModified =Replace($(vFieldname),' ','_');&lt;BR /&gt;RENAME Field [$(vFieldname)] TO $(vFieldnameModified);&lt;BR /&gt;Next fieldIdx&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 16:32:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1763003#M594868</guid>
      <dc:creator>Zaga_69</dc:creator>
      <dc:date>2020-11-19T16:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Rename all fields programmatically from each table in script</title>
      <link>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1763086#M594869</link>
      <description>&lt;P&gt;I believe you need single quotes around the Fieldname in Replace:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;LET vFieldnameModified =Replace('$(vFieldname)', ' ' ,'_');&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Without that you are doing a replace against the value of the field, not the field name.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-Rob&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 23:01:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rename-all-fields-programmatically-from-each-table-in-script/m-p/1763086#M594869</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2020-11-19T23:01:19Z</dc:date>
    </item>
  </channel>
</rss>

