Forum Discussion

MP_123's avatar
MP_123
Icon for Microsoft Employee rankMicrosoft Employee
9 years ago
Solved

Iterate over each cell in a table

hi, i want to iterate on each cell in the column (don't know how many rows and column will be, but it's not complicated to get) i want to call a function from each cell, how can i do it? also poss...
  • Anonymous's avatar
    Anonymous
    9 years ago

    Hi MP_123,

     

    Perhaps you can try to write a function to check the table columns which contain the specified delimiter.

     

    For example:

    let
        ContainColumn= (sourcetable as table, delimiter as text) =>
        let
            ColumnName= Table.ColumnNames(sourcetable),
            result= List.Transform(ColumnName, each if List.Count(List.Select(Table.Column(sourcetable , _ ),each try Text.Contains(_ ,delimiter) otherwise null))>0 then _ else null),
            RemoveNull=List.RemoveNulls(result)
        in
            RemoveNull
    in
        ContainColumn

     

    Invoke:

     

     

    Regards,

    Xiaoxin Sheng