Forum Discussion
Anonymous
6 years agoNot applicable
Failed to save modifications to the server when calling API
Hi everyone I am getting the following error when I click "Apply Now" in power query. Failed to save modifications to the server. Error returned: 'Expression in partition 'n/a' in table 'n/a' re...
- Anonymous6 years ago
I have a similar problem and fix it to solve it NOT using the feaure preview "Store datasets using enhanced metadata format"
Anonymous
6 years agoNot applicable
Hi Anonymous ,
Could you please provide the source code for every query in Advanced Editor? Is there any warning icon in front of every query? Need to check the data source of every query, and if they refer any invalid data...
Best Regards
Rena
Anonymous
6 years agoNot applicable
Hi Anonymous
Thanks for replying, please find my advanced query below (I XXXXX'd out my apikey and Url):
You could basically do the same thing with any paged api call.
let
BaseUrl = "https://api.XXXXXXXXX.com/v1/bookings?",
EntitiesPerPage = 10,
GetJson = (Url) =>
let Options = [Headers=[apiKey="XXXXXXXXXXXXXXXXXXXXXXXX"]],
RawData = Web.Contents(Url, Options),
Json = Json.Document(RawData)
in Json,
GetEntityCount = () =>
let Count = 20
in Count,
GetPage = (Index) =>
let Offset = "&offset=" & Text.From(Index * EntitiesPerPage),
Limit = "&limit=" & Text.From(EntitiesPerPage),
Url = BaseUrl & Offset & "&" & Limit,
Json = GetJson(Url),
Value = Json[#"bookings"]
in Value,
EntityCount = List.Max({ EntitiesPerPage, GetEntityCount() }),
PageCount = Number.RoundUp(EntityCount / EntitiesPerPage),
PageIndices = { 0 .. PageCount - 1 },
Pages = List.Transform(PageIndices, each GetPage(_)),
Entities = List.Union(Pages),
Table = Table.FromList(Entities, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(Table, "Column1", {"orderNumber", "status", "supplierId", "supplierName", "supplierAlias", "createdBy", "customer", "items", "totalAmount", "totalCurrency", "totalPaid", "totalDue", "dateCreated", "dateConfirmed", "datePaid", "comments", "internalNotes", "payments", "fields", "source", "sourceChannel", "resellerComments", "vouchers", "resellerReference"}, {"Column1.orderNumber", "Column1.status", "Column1.supplierId", "Column1.supplierName", "Column1.supplierAlias", "Column1.createdBy", "Column1.customer", "Column1.items", "Column1.totalAmount", "Column1.totalCurrency", "Column1.totalPaid", "Column1.totalDue", "Column1.dateCreated", "Column1.dateConfirmed", "Column1.datePaid", "Column1.comments", "Column1.internalNotes", "Column1.payments", "Column1.fields", "Column1.source", "Column1.sourceChannel", "Column1.resellerComments", "Column1.vouchers", "Column1.resellerReference"})
in
#"Expanded Column1"
Cheers