Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
Hi
I am very new to Power BI and trying to learn on the job
I have inherited some Power BI Queries that I need to update but the person who wrote them is no longer with the organisation, therefore I some help!!
I am getting data from an Assetic (Enterprise Asseet Management Software) database and bringing into Power BI
This the code I have:
let
// Assetic base URL
asseticUrl = "https://*************.assetic.net",
// Assetic advanced search profile GUID
asseticSearchGuid = "************",
// Assetic username
asseticUsername = "****************",
// Assetic authorisation token
asseticToken = "************",
// HTTP basic credentials Base-64 encoded
base64Auth = Binary.ToText(
Text.ToBinary(asseticUsername & ":" & asseticToken), BinaryEncoding.Base64
),
// HTTP Headers
httpHeaders = [
ContentType = "Application/JSON",
Authorization = "Basic " & base64Auth
],
// Export advanced search profile results (POST /api/v2/search/{id}/export)
asseticTaskId = Json.Document(
Web.Contents(
asseticUrl,
[
Headers = httpHeaders,
RelativePath = "api/v2/search/" & asseticSearchGuid & "/export",
Content = Json.FromValue("{}")
]
)
),
// Get status of the export (GET /api/v2/backgroundtask/{id})
getAsseticTask = () => Json.Document(
Web.Contents(
asseticUrl,
[
Headers = httpHeaders,
RelativePath = "api/v2/backgroundworker/" & asseticTaskId,
IsRetry = true
]
)
),
// Returns true if export task completes within 'n' x 'm' secs
asseticTaskComplete = List.MatchesAny(
List.Repeat({5}, 30),
each Function.InvokeAfter(() => getAsseticTask(), #duration(0, 0, 0, _)
)[Status] = "Completed"
),
// Wait until export of results is complete
asseticTask = if asseticTaskComplete
then
getAsseticTask()
else
error ("Assetic export task failed to retrieve results"),
// Download document (GET /api/v2/document/{documentId}/file)
asseticFileCsv = Csv.Document(
Web.Contents(
asseticUrl,
[
Headers = httpHeaders,
RelativePath = "api/v2/document/" & asseticTask[DocumentId] & "/file"
]
)
),
// Promote the first row of values as column headers
Source = Table.PromoteHeaders(asseticFileCsv)
in
Source
The part of the code I am having issues with is in red font. I need to extend the time limit before the error message "Assetic export task failed to retrieve results" appears
Any help is appreciated!
Thanks
GT
Solved! Go to Solution.
List.Repeat({5}, 30),
each Function.InvokeAfter(() => getAsseticTask(), #duration(0, 0, 0, _)
It tries 30 times and waits five seconds between tries. I would up the seconds value a bit - do you really need to check every five seconds?
Thanks Ibendlin
I will try increasing the seconds value. Not sure why it was set at 5 seconds
Cheers
GT
List.Repeat({5}, 30),
each Function.InvokeAfter(() => getAsseticTask(), #duration(0, 0, 0, _)
It tries 30 times and waits five seconds between tries. I would up the seconds value a bit - do you really need to check every five seconds?
| User | Count |
|---|---|
| 51 | |
| 40 | |
| 35 | |
| 23 | |
| 22 |
| User | Count |
|---|---|
| 134 | |
| 103 | |
| 57 | |
| 43 | |
| 38 |