This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let func = | |
(Table as table, MyFunction as function) => | |
let | |
OldColumnNames = Table.ColumnNames(Table), | |
NewColumnNames = List.Transform(OldColumnNames, MyFunction), | |
RenameList = List.Zip({OldColumnNames, NewColumnNames}), | |
RenameColumns = Table.RenameColumns(Table, RenameList) | |
in | |
RenameColumns , | |
documentation = [ | |
Documentation.Name = " Table.RenameColumnsWithFunction ", | |
Documentation.Description = " Returns a <code>Table</code> with the column names transformed according to <code>MyFunction</code> from the 2nd parameter ", | |
Documentation.LongDescription = " Returns a <code>Table</code> with the column names transformed according to <code>MyFunction</code> from the 2nd parameter ", | |
Documentation.Category = " Table ", | |
Documentation.Source = " ", | |
Documentation.Version = " 1.0 ", | |
Documentation.Author = " Imke Feldmann: www.TheBIccountant.com . ", | |
Documentation.Examples = {[Description = " see this blogpost: https://wp.me/p6lgsG-UZ ", | |
Code = " let | |
Table = #table( {""TABLENAME.FirstColumn"", ""TABLENAME.SecondColumn""}, { {""A"" ,""B""} } ), | |
FunctionCall = fnTableRenameColumnsFunction(Table, each Text.Replace(_, ""TABLENAME."", """")) | |
in | |
FunctionCall ", | |
Result = " #table( {""FirstColumn"", ""SecondColumn""}, { {""A"" ,""B""} } ) "]}] | |
in | |
Value.ReplaceType(func, Value.ReplaceMetadata(Value.Type(func), documentation)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment