Forum Discussion
Can we skip data access (Getting data from a source ) in case we don't have access or something else
- 1 year ago
Hi KR300
Did you gpot any chance to look over below suggested code replace it in your code.
To handle errors gracefully in Power BI when a specific API call (based on a parameter like FixVersionName) fails or returns no data, and still allow your report and scheduled refresh to succeed, you can use try ... otherwise to safely fall back to a blank placeholder table. Here’s how to do it in your scenario:
********************************************************let
FixVersionName = ... // your parameter
Placeholder = #table(
{"Key", "Summary", "IssueType Name", "Component Name", "FixVersion Name", "Priority Name", "Status Name"},
{{"", "", "", "", "", "", ""}}
),SafeCall = try Json.Document(
Web.Contents(
"https://jira.tools.deloitteinnovation.us/rest/api/2/search?jql=project%20%3D%20SMAR%20AND%20issuetyp..." &
FixVersionName & "&maxResults=1000&fields=key,summary,fixVersions,priority,status,components,issuetype"
)
),Source = if SafeCall[HasError] then Placeholder else SafeCall[Value]
in
Source********************************************************
You can then continue your existing transformation steps on this Source safely, as it will always return a valid table shape (even if empty).
If the above information helps you, please give us a Kudos and marked the Accept as a solution.
Best Regards,
Community Support Team _ C Srikanth
Hi KR300
Did you gpot any chance to look over below suggested code replace it in your code.
To handle errors gracefully in Power BI when a specific API call (based on a parameter like FixVersionName) fails or returns no data, and still allow your report and scheduled refresh to succeed, you can use try ... otherwise to safely fall back to a blank placeholder table. Here’s how to do it in your scenario:
********************************************************
let
FixVersionName = ... // your parameter
Placeholder = #table(
{"Key", "Summary", "IssueType Name", "Component Name", "FixVersion Name", "Priority Name", "Status Name"},
{{"", "", "", "", "", "", ""}}
),
SafeCall = try Json.Document(
Web.Contents(
"https://jira.tools.deloitteinnovation.us/rest/api/2/search?jql=project%20%3D%20SMAR%20AND%20issuetyp..." &
FixVersionName & "&maxResults=1000&fields=key,summary,fixVersions,priority,status,components,issuetype"
)
),
Source = if SafeCall[HasError] then Placeholder else SafeCall[Value]
in
Source
********************************************************
You can then continue your existing transformation steps on this Source safely, as it will always return a valid table shape (even if empty).
If the above information helps you, please give us a Kudos and marked the Accept as a solution.
Best Regards,
Community Support Team _ C Srikanth