14 Replies Latest reply: Aug 31, 2017 2:30 PM by Rob Wunderlich RSS

    Renaming Fields using a Mapping Table

    Erica Trotter

      Hi, I am trying to rename fields in my table using a mapping table, I didn't want to use apply map because of its limitations so I am trying to do it manually. It is currently loading but it is not renaming the the fields, is there something wrong with my script? In loading the original fields I used Qualify so they are showing up Table.Field. Please let me know if you have any ideas:




      ('$(vTable)' & '.' & Field) AS FieldName,


      FROM [lib://AttachedFiles/FieldMap.xlsx]

      (ooxml, embedded labels, table is $(vTable);


              Let j = 1;

      For j = 1 to noofrows('MappingTable')

      Set vOldFieldName = peek(‘FieldName(j)-1, ‘MappingTable’);

      Set vNewFieldName = peek(‘Rename’, $(j)-1, ‘MappingTable’);


      Rename Field [$(vOldFieldName)] to [$(vNewFieldName)];


      Next j;