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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors