Forum Discussion

masplin's avatar
masplin
Impactful Individual
8 years ago
Solved

How to handle a single error on web based table navigation

I have have built two functions to call data from a web based source using a list of 200 different url parts. The url basically just ends in a company name. I needed 2 functions as the html paths wer...
  • ImkeF's avatar
    ImkeF
    8 years ago

    Hi Mike, I've changed the step "Added Custom1", pls try it out:

     

    let
         DummyTable = Table.PromoteHeaders(Table.FromRows({{"Description", "Index"}})),
        Source = Excel.Workbook(File.Contents("U:\Dropbox\Limerston\Crawford\CRO Companies.xlsx"), null, true),
        CRO_Company_Table = Source{[Item="CRO_Company",Kind="Table"]}[Data],
        #"Changed Type" = Table.TransformColumnTypes(CRO_Company_Table,{{"Company", type text}, {"Address", type text}, {"Search", type text}}),
        #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Web_Main([Search])),
        #"Sorted Rows1" = Table.Sort(#"Added Custom",{{"Company", Order.Ascending}}),
        #"Expanded Custom" = Table.ExpandTableColumn(#"Sorted Rows1", "Custom", {"#(lf)Website#(lf)", "#(lf)Headquarters#(lf)", "#(lf)Laboratories#(lf)", "#(lf)Company Type#(lf)", "#(lf)Certifications#(lf)", "#(lf)Year Established#(lf)", "#(lf)No. of Employees#(lf)"}, {"#(lf)Website#(lf)", "#(lf)Headquarters#(lf)", "#(lf)Laboratories#(lf)", "#(lf)Company Type#(lf)", "#(lf)Certifications#(lf)", "#(lf)Year Established#(lf)", "#(lf)No. of Employees#(lf)"}),
        #"Added Custom1" = Table.AddColumn(#"Expanded Custom", "Custom", each try Web_Description([Search]) otherwise DummyTable),
        #"Removed Errors" = Table.RemoveRowsWithErrors(#"Added Custom1", {"Custom"}),
        #"Expanded Custom1" = Table.ExpandTableColumn(#"Removed Errors", "Custom", {"Description"}, {"Description"})
    in
        #"Expanded Custom1"