Forum Discussion
Combine 4 M-Codes into 1
- 2 years ago
let Source = Table.FromRows( Json.Document( Binary.Decompress( Binary.FromText( "jY/NaoNQEEZfZdCtifNzr/eOu0RNI20TUUMI4iJQS6E0hTYU+vbVdidZdBbf6hw403VBtr0PAcUtkFTESWI9tKeqSEGdB6SYNGYT9FEXVKsTPJS7okkpGjUI2SDSmnA857xxiLe5CTDJCJuo3LVFXTQtrB7bFGgpMwVSjszCQnUH6wzqwy606hzYKWZKFWZV8WrN3KPJOWz/JFUiGIfhuP/1qDmSYfTiDew3m6Zob6d6FrE69pKSkP4Lmj0ly7k3xeV5XA9fw8fn8ATl5fkdqvP323C5QvbyGorhRIXVQn5NAU1MFDOyBH3/Aw==", BinaryEncoding.Base64 ), Compression.Deflate ) ), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Transaction_Comment = _t] ), #"Added Custom4" = Table.AddColumn( Source, "Custom.4", each Text.Trim( Text.AfterDelimiter(Text.AfterDelimiter(Text.Upper([Transaction_Comment]), "CHK"), "#") ) ), #"Split Column by Character Transition" = Table.SplitColumn( #"Added Custom4", "Custom.4", Splitter.SplitTextByCharacterTransition( {"0" .. "9", "A" .. "Z", "-"}, (c) => not List.Contains({"0" .. "9", "A" .. "Z", "-"}, c) ), {"CHK#"} ) in #"Split Column by Character Transition"How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done". Once you examined the code, replace the Source step with your own source.
i dont see any extra spaces after the column name and the name of the column does have an underscore.
#"Added Custom4" = Table.AddColumn(
Source,
"Custom.4",
each Text.Trim(
Text.AfterDelimiter(Text.AfterDelimiter(Text.Upper([#"Transaction_Comment"]), "CHK"), "#")
)
),- meierli2 years agoHelper I
still keep getting error
Expression.Error: The field 'Transaction_Comment' of the record wasn't found.
Details:
Content=[Binary]
Name=FFS Payment Detail Comments_LiveData_202401.xlsm
Extension=.xlsm
Date accessed=2/20/2024 3:18:09 PM
Date modified=1/30/2024 11:25:00 AM
Date created=1/30/2024 11:17:00 AM
Attributes=
Content Type=application/vnd.ms-excel.sheet.macroEnabled.12
Kind=Excel File
Size=17658135
ReadOnly=FALSE
Hidden=FALSE
System=FALSE
Directory=FALSE
Archive=TRUE
Device=FALSE
Normal=FALSE
Temporary=FALSE
SparseFile=FALSE
ReparsePoint=FALSE
Compressed=FALSE
Offline=FALSE
NotContentIndexed=FALSE
Encrypted=FALSE
ChangeTime=2/20/2024 2:50:43 PM
SymbolicLink=FALSE
MountPoint=FALSE
Folder Path=C:\Users\lmeier\Desktop\FFS Reports\ - lbendlin2 years agoSuper User
Check your spelling again. Power Query is case sensitive.
- meierli2 years agoHelper I
Thanks for your help, but I checked everything. Guess I am not going to be able to implement the code and will just keep runnning the seperate codes.
- lbendlin2 years agoSuper User
can you post a sanitized version of the .xlsm file?
- meierli2 years agoHelper I
i dont see an option to upload a cleaned up version of the file.
- meierli2 years agoHelper I
Since I can't upload the file, I just copied first couple rows from the original macro file.
Reporting_PeriodGrpTransaction_FSC_KeyFsc_NamePaycode_NumberInvoice_NumberTransaction_Posting_PeriodTransaction_DatePS_CustomerPaycode_NameCheck_NumberCheck_DateTransaction_CommentGrp100_Flag Payment_Amount
202401 TPRIYA TX from Invoice#81238879 to Invoice#82221869 202401 DDEVARAKONDA Tx from Inv#81238889 to Inv#82222993 202401 PAY INFO 139406515 01/17/24 202401 PAY INFO 138530633 01/05/24 202401 CHK# 037-0193283221 TYPE: 971 01/19/24 202401 PAY INFO 138530429 01/05/24 202401 PAY INFO 138386018 01/03/24 202401 MC 1055 012324 NOEL LAMAS 202401 PAY INFO 137679596 12/22/23 202401 PAY INFO 138366337 01/03/24 202401 TRAGULA tx from INV# 81249453 of GRP#7 to INV#82273042 of GRP#100. 202401 MRD/TIMELY FILING TO 6 202401 TPRIYA TX from Invoice#81249638 to Invoice#82173176 202401 PAY INFO 138095589 12/29/23