Forum

List.Accumulate app...
 
Notifications
Clear all

List.Accumulate applied second time doesn't work

5 Posts
2 Users
0 Reactions
106 Views
(@bluesky63)
Posts: 162
Estimable Member
Topic starter
 

Hi Catalin Sir,

Previous you had shared with me on the List.Accumulate usage on List of deliminters,  when I applied the same codes second time (Trim2) all became blank ?

For your advise please

 

let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Documents", type text}}),
Trim1 = List.Accumulate(Table2, #"Changed Type", (TransformedTable, ReplacementItem) =>
Table.TransformColumns(TransformedTable, {{"Documents", each Text.BeforeDelimiter(_, ReplacementItem), type text}})),
Trim2 = List.Accumulate(Table3, Trim1, (TransformedTable, ReplacementItem) =>
Table.TransformColumns(TransformedTable, {{"Documents", each Text.AfterDelimiter(_, ReplacementItem), type text}}))
in
Trim2

 
Posted : 23/11/2020 10:40 pm
(@catalinb)
Posts: 1937
Member Admin
 

In the second, that is using TextAfterDelimiter, use:

Text.AfterDelimiter(_, ReplacementItem,{0, RelativePosition.FromEnd})

 
Posted : 24/11/2020 12:02 am
(@bluesky63)
Posts: 162
Estimable Member
Topic starter
 

Hi Catalin,

Is it because the other two do no have prefix attached to it so we need to specify  {0, RelativePosition.FromEnd} ?

anyway it works and thank you so much !!

 
Posted : 24/11/2020 8:42 am
(@catalinb)
Posts: 1937
Member Admin
 

No, it's because first is using Text.BeforeDelimiter and the delimiter is at the end of the string,

and the second is using AfterDelimiter but the delimiter is at the beginning of the string.

 
Posted : 24/11/2020 9:05 am
(@bluesky63)
Posts: 162
Estimable Member
Topic starter
 

Hi Catalin,

Ooh yah,  so before all the delimiters of strings definitely is blank white space

Thank you so much !!

 
Posted : 24/11/2020 8:59 pm
Share: