Forum Discussion

JustDavid's avatar
JustDavid
Icon for Helper V rankHelper V
1 year ago
Solved

ReplaceValue of each Table Record

PQ Gurus,   As you can see, I have a Table on each record.   What I'd like to accomplish (if possible) is to do via Table.ReplaceValue( ... , each ... , Replacer.ReplaceText() ) on each of the ta...
  • ronrsnfld's avatar
    1 year ago

    Kind of tough since you force someone to create an example and don't show desired results. Hopefully I have understood you well enough that you can adapt this code to your real problem.

     

    BTW, I really don't understand your stated logic. An example of before and after would clarify that, but you can probably change the logic in the code below to suit your requirements.

     

    Your file is not useful since the data source is not included.

     

    But try something like the code below, which will transform each table in your column of tables before you expand them:

     

    Before:

     

     

     

     

    let
    
    //Replace Source with your table that has a column populated by Tables
        Source = Table.FromColumns({{Table9,Table10,Table11}}, type table[Table=table]),
    
    //Transform each table according to your stated logic
    //you may need to modify this as I probably mis-understood what you require
        replace = Table.TransformColumns(Source,{    
            {"Table", (t)=>Table.ReplaceValue(
                t,
                each [Full Description],
                null,
                (x,y,z)=>List.Skip(Text.Split(y,"-"),2){0},
                {"Full Description"})
            }
        })
    in
        replace

     

     

     

    After: