Forum Discussion
Cache Text.Split / List Select line for multiple evaluation
- 7 months ago
Is this along the lines of what you are looking for?
SplitAndCombine = Table.AddColumn( Quelle, "Test", each let codeBlock = List.Buffer(List.Select(Text.SplitAny([hea], " _"), each _ <> "")) in if List.Contains({"id", "key", "number"}, List.Last( codeBlock ), Comparer.OrdinalIgnoreCase) = true and List.Count( codeBlock ) > 1 then Text.Combine( List.RemoveLastN( codeBlock, 1 ), " ") else [hea] )
Hi Jgeddes,
in the file behind the link in the Query 'Table1' Step 'SplitAndCombine' achieves the intended output. Step 'SplitAndBuffer' shall achieve the same, but with somehow buffering the List.Select(Text.SplitAny)) piece.
Best regards, Andreas
Is this along the lines of what you are looking for?
SplitAndCombine =
Table.AddColumn(
Quelle,
"Test",
each
let
codeBlock = List.Buffer(List.Select(Text.SplitAny([hea], " _"), each _ <> ""))
in
if List.Contains({"id", "key", "number"}, List.Last( codeBlock ), Comparer.OrdinalIgnoreCase) = true and List.Count( codeBlock ) > 1 then
Text.Combine( List.RemoveLastN( codeBlock, 1 ), " ")
else
[hea]
)- Goodkat7 months ago
Helper II
Dear Jgeddes,
Holy Smokes Sir!
That is exactly what I was looking to achieve! Super! And now I have a hands-on example of wrapping a 'let / in' statement within another 'let / in'. I had seen this before, but did not fully understand when and where I could use such construct. Now I know...
Thank you so much! You helped a ton and provided good insights to further bank on at my end!
Best regards, Andreas