Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
I'm rather new to M code. I'm trying to get the current date as a variable to appear inside this XML API call that is wrapped up in a Text.ToBinary function. Any suggestions?
let
defined = DateTime.ToText(DateTime.LocalNow()),
Source = Xml.Tables(Web.Contents("https:...ReportingWs.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:ConsolidatedReport>
<rep:sLocationCodesCommaDelimited>L001,L002</rep:sLocationCodesCommaDelimited>
<rep:sCorpUserName>...</rep:sCorpUserName>
<rep:sCorpPassword>...</rep:sCorpPassword>
<rep:dReportDateStart>2018-04-01T00:00:00</rep:dReportDateStart>
<rep:dReportDateEnd>defined</rep:dReportDateEnd>
</rep:ConsolidatedReport>
</soapenv:Body>
</soapenv:Envelope>"),Headers=[#"Accept-Encoding"="gzip,deflate", #"Content-Type"="text/xml;charset=UTF-8"]]))
in
Source
Solved! Go to Solution.
I am not familliar with that function but it seems that you have done a simmilar thing already in the fucntion. Have you tried the same technique you used earlier? ("&Character.FromNumber(34)&")
That is instead of
<rep:dReportDateEnd>defined</rep:dReportDateEnd>
<rep:dReportDateEnd>" & defined & "</rep:dReportDateEnd>?
I am not familliar with that function but it seems that you have done a simmilar thing already in the fucntion. Have you tried the same technique you used earlier? ("&Character.FromNumber(34)&")
That is instead of
<rep:dReportDateEnd>defined</rep:dReportDateEnd>
<rep:dReportDateEnd>" & defined & "</rep:dReportDateEnd>?
Thanks ThisIsFalse. I had been trying to use "Character.FromNumber(34)&"Defined"&Character.FromNumber(34)" as I incorrectly thought it needed to be in double quotes. I also had the date variable formatted differently than the API required. Here's the line I used:
<rep:dReportDateEnd>"&Defined&"</rep:dReportDateEnd>
Well I am glad you got it sorted out. I felt that it was a little too simple the way you presented it, formatting is always an issue with this kind of thing.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 44 | |
| 43 | |
| 38 | |
| 18 | |
| 16 |
| User | Count |
|---|---|
| 67 | |
| 63 | |
| 30 | |
| 30 | |
| 23 |