Forum Discussion

gvg's avatar
gvg
Icon for Post Prodigy rankPost Prodigy
5 years ago
Solved

Get substring of every column in table

Hi folks, I am looking to figure out how to get a substring of every column in a table with a variable number of columns. My code looks like this but it is not working. It is expected to take a subs...
  • CNENFRNL's avatar
    5 years ago

    It's vital to understand use of different each and its different evaluation contextin in different functions.

    let
        Source = myTable,
        myColumns = Table.ColumnNames(Source),
        Custom1 = List.Accumulate(myColumns, Source, (s,c) => Table.ReplaceValue(s, each Record.Field(_, c), each Text.Start(Text.From(Record.Field(_, c)), 3), Replacer.ReplaceValue, {c}))
    in
        Custom1