Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now
Hi, I am learning Power Query and trying to figure out why the third API call in my code is not being executed, I'm talking about the Post call to webhook named hello4. If I remove the second api call (hello3) the hello4 works but if hello3 is there hello4 is not executed. I've tried to wrap hello4 in function invoke but no luck. Thanks in advance for any help
// This file contains your Data Connector logic
section PrivacyRequests;
[DataSource.Kind="PrivacyRequests", Publish="PrivacyRequests.Publish"]
shared PrivacyRequests.Contents = (optional message as text) =>
let
webhook = "https://webhook.site/7934c414-bd62-4b8e-8387-d7afc1554d7e",
url = "https://trial.onetrust.com/api/access/v1/oauth/token",
request = "https://trial.onetrust.com/api/incident/v1/incidents/search?page=0&size=20&sort=createdDate,desc",
requestsingle = "https://trial.onetrust.com/api/incident/v1/incidents/",
postData = "",
GetJson = Web.Contents(url,
[
Headers = [#"Content-Type"="application/x-www-form-urlencoded"],
Content = Text.ToBinary("grant_type=client_credentials&client_id={{client_id}}&client_secret={{client_secret}}")
]
),
FormatAsJson = Json.Document(GetJson),
AccessToken = FormatAsJson[access_token],
AccessTokenHeader = "Bearer " & AccessToken,
incidentid = "b6d86421-039a-4c86-af9c-86ad49442b23",
hello =
let
hello3 = Json.Document(Web.Contents(requestsingle & incidentid, [Headers=[#"Authorization"=AccessTokenHeader, #"Content-Type"="application/json"]])),
hello4 = Web.Contents("https://webhook.site/150646c4-ac6c-45ec-9685-c438434e032f", [Content="hello",Headers=[#"Content-Type"="application/json"]])
in
hello3
in
hello;
Solved! Go to Solution.
Let variables are evaluated lazily. In other words, they're only evaluated when they are referenced by some executing M code. Because your let expression only references hello3 (and not hello4), only hello3 is executed.
Let variables are evaluated lazily. In other words, they're only evaluated when they are referenced by some executing M code. Because your let expression only references hello3 (and not hello4), only hello3 is executed.
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 |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 6 | |
| 6 | |
| 5 |