Forum Discussion
Split by Positions when positions are in 3 separate columns
- 1 year ago
Add this line to your code to create the list:
#"Added Custom4" = Table.AddColumn(#"Added Custom3", "Splitter List", each Splitter.SplitTextByPositions( {0} & List.LastN(Record.FieldValues(_),4))([#"Provider Name, City, State, Zip"]))And, as a suggestion, instead of reading it in as an Excel table, and taking a chance on unwanted transformations caused by Excel, I would read the `csv` file directly:
Source = Csv.Document(File.Contents("full_path_to_file\export.csv"),[Delimiter=",", Columns=9, Encoding=65001, QuoteStyle=QuoteStyle.None]), #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]), #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Provider Name, City, State, Zip", type text}, {"Speciality", type text}, {"Credential", type text}, {"License", type text}, {"NPI", Int64.Type}, {"Accred Level", Int64.Type}, {"F=Full L=Limited", type text}, {"Eff. Date", type date}, {"Exp. Date", type date}}), ...Also, you will need to build in some error checking.
If you are missing a component (eg: phone number; street address, etc) your Position finder will return incorrect results.
Add this line to your code to create the list:
#"Added Custom4" = Table.AddColumn(#"Added Custom3", "Splitter List", each Splitter.SplitTextByPositions(
{0} & List.LastN(Record.FieldValues(_),4))([#"Provider Name, City, State, Zip"]))
And, as a suggestion, instead of reading it in as an Excel table, and taking a chance on unwanted transformations caused by Excel, I would read the `csv` file directly:
Source = Csv.Document(File.Contents("full_path_to_file\export.csv"),[Delimiter=",", Columns=9, Encoding=65001, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Provider Name, City, State, Zip", type text}, {"Speciality", type text}, {"Credential", type text}, {"License", type text}, {"NPI", Int64.Type}, {"Accred Level", Int64.Type}, {"F=Full L=Limited", type text}, {"Eff. Date", type date}, {"Exp. Date", type date}}),
...
Also, you will need to build in some error checking.
If you are missing a component (eg: phone number; street address, etc) your Position finder will return incorrect results.
Thank you so much!