Skip to content

Commit 4b099e0

Browse files
committed
Update 2024-03 - Using Pairs of Strict Splitters to Simplify Your Parsing Logic -- expanded.pq
1 parent ea2d5fa commit 4b099e0

1 file changed

Lines changed: 4 additions & 19 deletions

File tree

forumQuestions/pq/2024-03 - Using Pairs of Strict Splitters to Simplify Your Parsing Logic -- expanded.pq

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,7 @@ let
4949
Message.Format = "InvalidResultException: SplitByEachDelimiter did not return exactly #{0} segments #(cr,lf) String: '#{1}',"
5050
]
5151
][return],
52-
53-
// Summary = [
54-
// // Was = ProcessRows( Rows ),
55-
// Rows = #"Changed Type",
56-
// OneRow = Rows{0}?,
57-
// OneText = OneRow[Text]?,
58-
// Try1_Dash3_t = OneText,
59-
// z__ = _( [ name = "bob", id = 999 ]),
60-
// Try1_Dash3 = SplitBy_Dash3( OneText ),
61-
// Try1_Dash3_ = _( OneText )
62-
// ],
63-
Rows = #"Changed Type",// Summary[Rows],
64-
52+
Rows = #"Changed Type",
6553

6654
// get the crumbs, else throw when it's valid
6755
Col_Step1 = Table.AddColumn(
@@ -77,9 +65,6 @@ let
7765
Col_Step1, "Step2",
7866
(row) => [
7967
Crumbs = row[Step1],
80-
// SplitBy_TwoWhitespace = Splitter.SplitTextByWhitespace(
81-
// QuoteStyle.None
82-
// ),
8368
Id = Text.Trim( Crumbs{0} ),
8469
Name = Text.Trim( Crumbs{1} ),
8570
YearEnd = Text.Trim( Crumbs{2} ),
@@ -97,9 +82,9 @@ let
9782
Record.Type
9883
),
9984
// error if fields are ever missing:
100-
Step2 = Col_LineAsRecord{0}[Step2],
101-
Custom1 = Col_LineAsRecord,
85+
Step2 = Col_LineAsRecord{0}[Step2],
86+
Custom1 = Col_LineAsRecord,
10287
#"Expanded Step2" = Table.ExpandRecordColumn(Custom1, "Step2", {"Id", "Name", "YearStart", "YearEnd"}, {"Id", "Name", "YearStart", "YearEnd"}),
103-
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded Step2",{{"Id", Int64.Type}, {"Name", type text}})
88+
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded Step2",{{"Id", Int64.Type}, {"Name", type text}})
10489
in
10590
#"Changed Type1"

0 commit comments

Comments
 (0)