Forum Discussion
Rename Nested Tables Based on Condition
- 2 years ago
Hi JNB3
You need to use Table.TransformColumns to apply the same transformation to each nested table within the Custom column.
On way to do this, is to first create a function that is similar to your RenamedColumns step (I called this RenameFunction), then apply this function using Table.TransformColumns in the ApplyRenameFunction step below.
let // Define a function that will be applied to each nested table RenameFunction = each Table.TransformColumnNames( _, each if Text.Contains(_, "back", Comparer.OrdinalIgnoreCase) then Text.Replace(_, _, "Back") else _ ), // Source table Source = #"Added Custom", // Apply the function to each nested table in the Custom column ApplyRenameFunction = Table.TransformColumns(Source, {{"Custom", RenameFunction}}) in ApplyRenameFunctionDoes this work for you?
Regards
Hi JNB3
You need to use Table.TransformColumns to apply the same transformation to each nested table within the Custom column.
On way to do this, is to first create a function that is similar to your RenamedColumns step (I called this RenameFunction), then apply this function using Table.TransformColumns in the ApplyRenameFunction step below.
let
// Define a function that will be applied to each nested table
RenameFunction = each Table.TransformColumnNames(
_,
each
if Text.Contains(_, "back", Comparer.OrdinalIgnoreCase) then
Text.Replace(_, _, "Back")
else
_
),
// Source table
Source = #"Added Custom",
// Apply the function to each nested table in the Custom column
ApplyRenameFunction = Table.TransformColumns(Source, {{"Custom", RenameFunction}})
in
ApplyRenameFunction
Does this work for you?
Regards
Thank you so much! This worked perfectly! Thanks again!