Forum Discussion

alromeyn's avatar
alromeyn
Regular Visitor
9 years ago
Solved

Splitting PostgreSQL hstore fields

I have a column in my PostgeSQL data that is an hstore field. It contains data from our accounting software for user defined fields. I cannot use the split command because all data is not always ther...
  • Anonymous's avatar
    Anonymous
    9 years ago

    Hi alromeyn,

     

    You can refer to below steps to get the carrier name:

     

    Source:

     

     

    Formula:

     

    let
        Source = Table.FromColumns({Lines.FromBinary(File.Contents("C:\Users\xxxxx\Desktop\New Text Document.txt"), null, null, 1252)}),
        #"Replaced Value" = Table.ReplaceValue(Source," ","",Replacer.ReplaceText,{"Column1"}),//remove the space character
        #"Added Custom1" = Table.AddColumn(#"Replaced Value", "Carrier", each List.Select(Text.Split([Column1],","), each Text.Contains(_, "Carrier"))),//split column and select the record which contain "carrier"
        #"Expanded Temp" = Table.ExpandListColumn(#"Added Custom1", "Carrier"),//expandlist
        #"Replaced Value1" = Table.ReplaceValue(Table.ReplaceValue(#"Expanded Temp","""","",Replacer.ReplaceText,{"Carrier"}),"Carrier=>","",Replacer.ReplaceText,{"Carrier"})//remove " and "carrier=>"
    in
        #"Replaced Value1"



    Regards,

    Xiaoxin Sheng