Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
cleon169
Frequent Visitor

missing columns not returned when iterate through web service

I'm calling a SOAP API in XML to pull down a report into Power Query. The query iterates through a list of locations stored in a manual table. The problem I have is when the location doesn't have a value for a column, it doesn't return the column at all. This is resulting in the power query erroring out when it can't find the column. I'm assuming I need to define the elements using something like an element path, but I'm clueless on how to do that in the XML. Can anyone help please?

 

For example, I'm getting this error:

 

An error occurred in the ‘’ query. Expression.Error: The column 'MoveIn' of the table wasn't found.
Details:
    MoveIn

 

Here's the query:

(AllLocations) as table =>

let

MTDBegin = DateTime.ToText(Date.StartOfMonth(DateTime.LocalNow()), "yyyy-MM-ddT00:00:00"),
MTDEnd = DateTime.ToText(DateTime.LocalNow(), "yyyy-MM-ddThh:mm:ss"),

    Source = Xml.Tables(Web.Contents("https://.../...Ws.asmx?WSDL"

    ,[Content=Text.ToBinary("<soapenv:Envelope xmlns:soapenv="&Character.FromNumber(34)&"http://schemas.xmlsoap.org/soap/envelope/"&Character.FromNumber(34)&" xmlns:rep="&Character.FromNumber(34)&"http:/.../ReportingWs"&Character.FromNumber(34)&">
     <soapenv:Header/>
   <soapenv:Body>
      <rep:MoveInsAndMoveOuts>

         <!--Optional:-->
         <rep:sLocationCode>"&AllLocations&"</rep:sLocationCode>
         <!--Optional:-->
         <rep:sCorpUserName>...</rep:sCorpUserName>
         <!--Optional:-->
         <rep:sCorpPassword>...</rep:sCorpPassword>
         <rep:dReportDateStart>"&MTDBegin&"</rep:dReportDateStart>
         <rep:dReportDateEnd>"&MTDEnd&"</rep:dReportDateEnd>
      </rep:MoveInsAndMoveOuts>
   </soapenv:Body>

</soapenv:Envelope>"),Headers=[#"Accept-Encoding"="gzip,deflate", #"Content-Type"="text/xml;charset=UTF-8"]])),
    Table = Source{0}[Table],
    Table3 = Table{0}[Table],
    Table4 = Table3{0}[Table],
    Table5 = Table4{0}[Table],
    Table6 = Table5{1}[Table],
    Table7 = Table6{0}[Table],
    Table8 = Table7{0}[Table],
    Table9 = Table8{0}[Table],
    Table10 = Table9{0}[Table],
    #"Changed Type" = Table.TransformColumnTypes(Table10,{{"SiteID", Int64.Type}, {"MoveIn", Int64.Type}, {"MoveOut", Int64.Type}, {"Transfer", Int64.Type}, {"MoveDate", type datetimezone}, {"UnitName", type text}, {"TenantName", type text}, {"Width", type number}, {"Length", type number}, {"UnitSize", type text}, {"StandardRate", type number}, {"MovedInArea", type number}, {"MovedInRentalRate", type number}, {"MovedInVariance", type number}, {"MovedInDaysVacant", Int64.Type}, {"MovedOutArea", type number}, {"MovedOutRentalRate", type number}, {"MovedOutVariance", type number}, {"MovedOutDaysRented", Int64.Type}, {"Address", type text}, {"City", type text}, {"Region", type text}, {"PostalCode", Int64.Type}, {"dcDiscount", type number}, {"iLeaseNum", Int64.Type}, {"dRentLastChanged", type datetimezone}, {"sEmpInitials", type text}, {"TenantID", Int64.Type}, {"iAuctioned", Int64.Type}, {"dcPushRateAtMoveIn", type number}, {"dcStdRateAtMoveIn", type number}, {"bPower", type logical}, {"bClimate", type logical}, {"bAlarm", type logical}, {"bInside", type logical}, {"sUnitType", type text}, {"iDaysSinceMoveOut", Int64.Type}, {"dcAmtPaid", type number}, {"InquiryEmployeeID", Int64.Type}, {"CorpUserID_ConvertedToMoveIn", Int64.Type}})

in
#"Changed Type"

 

 

1 REPLY 1
v-yuezhe-msft
Employee
Employee

@cleon169,

I note that the #"Changed Type" step metions the 'MoveIn' column. When your table doesn't have this column, the above error will throw. Please delete the "Change Type" step under "APPLED STEPS" in Query Editor of Power BI Desktop.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors
Top Kudoed Authors