We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Im getting an error I can't figure out, can you help me? Ive made sure the ID's and PAT are all correct
---------- Message ---------- [Expression.Error] We cannot convert the value null to type Record.
---------- Session ID ---------- f8d0e823-c89f-4a0c-9444-6c014f15c52f
---------- Mashup script ---------- section Section1; shared Query = let // Pagination Logic: This part handles pagination by making API calls to Airtable with different offsets to retrieve paginated data. Pagination = List.Skip( List.Generate( () => [Page_Key = "init", Counter=0], // Initialize page key and counter each [Page_Key] <> null, // Continue generating while Page_Key is not null each [ Page_Key = try if [Counter] < 1 then "" else [WebCall][Value][offset] otherwise null, // Determine the next Page_Key WebCall = try if [Counter] < 1 then // Initial API call without offset Json.Document( Web.Contents( "https://api.airtable.com", [ RelativePath = "v0/" & BASE_ID & "/" & TABLE_ID & "?view=" & VIEW_ID, Headers = [Authorization = "Bearer " & PERSONAL_ACCESS_TOKEN] ] ) ) else // Subsequent API calls with offset Json.Document( Web.Contents( "https://api.airtable.com", [ RelativePath = "v0/" & BASE_ID & "/" & TABLE_ID & "?view=" & VIEW_ID & "&offset=" & [WebCall][Value][offset], Headers = [Authorization = "Bearer " & PERSONAL_ACCESS_TOKEN] ] ) ), Counter = [Counter] + 1 // Increment the counter for each iteration ], each [WebCall] ), 1 ),
// Convert the paginated data into a table #"Converted to Table" = Table.FromList( Pagination, Splitter.SplitByNothing(), null, null, ExtraValues.Error ), // Expand and structure the paginated data #"Expanded Column1" = Table.ExpandRecordColumn( #"Converted to Table", "Column1", {"Value"}, {"Column1.Value"} ), #"Expanded Column1.Value" = Table.ExpandRecordColumn( #"Expanded Column1", "Column1.Value", {"records"}, {"Column1.Value.records"} ), #"Expanded Column1.Value.records" = Table.ExpandListColumn( #"Expanded Column1.Value", "Column1.Value.records" ), #"Expanded Column1.Value.records1" = Table.ExpandRecordColumn( #"Expanded Column1.Value.records", "Column1.Value.records", {"id", "fields", "createdTime"}, {"Column1.Value.records.id", "Column1.Value.records.fields", "Column1.Value.records.createdTime"} ), // Rename columns to align with a specific naming convention. #"Renamed Columns" = Table.RenameColumns( #"Expanded Column1.Value.records1", { {"Column1.Value.records.id", "_airtableRecordId"}, {"Column1.Value.records.createdTime", "_airtableRecordCreatedAt"}, {"Column1.Value.records.fields", "_airtableRecordFields"} } ), // Reorder columns to the desired order. #"Reordered Columns" = Table.ReorderColumns( #"Renamed Columns", {"_airtableRecordId", "_airtableRecordCreatedAt", "_airtableRecordFields"} ), // Expand the record fields dynamically based on distinct field names, ensuring that all fields are expanded regardless of schema changes. #"Expanded Record Fields" = Table.ExpandRecordColumn( #"Reordered Columns", "_airtableRecordFields", List.Distinct(List.Combine(List.Transform( List.Transform(Table.ToRecords(#"Reordered Columns"), each Record.Field(_, "_airtableRecordFields")), each Record.FieldNames(_) ))), List.Distinct(List.Combine(List.Transform( List.Transform(Table.ToRecords(#"Reordered Columns"), each Record.Field(_, "_airtableRecordFields")), each Record.FieldNames(_) ))) )
in #"Expanded Record Fields"; shared PERSONAL_ACCESS_TOKEN = "xxxxxxxxxx" meta [IsParameterQuery = true, IsParameterQueryRequired = true, Type = "Text"]; shared BASE_ID = "xxxxxxxxxxx" meta [IsParameterQuery = true, IsParameterQueryRequired = true, Type = "Text"]; shared TABLE_ID = "xxxxxxxxxx" meta [IsParameterQuery = true, IsParameterQueryRequired = true, Type = "Text"]; shared VIEW_ID = "xxxxxxx" meta [IsParameterQuery = true, IsParameterQueryRequired = true, Type = "Text"];
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Im getting an error I can't figure out, can you help me?
Ive made sure the ID's and PAT are all correct
---------- Message ----------
[Expression.Error] We cannot convert the value null to type Record.
---------- Session ID ----------
f8d0e823-c89f-4a0c-9444-6c014f15c52f
---------- Mashup script ----------
section Section1;
shared Query = let
// Pagination Logic: This part handles pagination by making API calls to Airtable with different offsets to retrieve paginated data.
Pagination = List.Skip(
List.Generate(
() => [Page_Key = "init", Counter=0], // Initialize page key and counter
each [Page_Key] <> null, // Continue generating while Page_Key is not null
each [
Page_Key = try if [Counter] < 1 then "" else [WebCall][Value][offset] otherwise null, // Determine the next Page_Key
WebCall = try if [Counter] < 1 then
// Initial API call without offset
Json.Document(
Web.Contents(
"https://api.airtable.com",
[
RelativePath = "v0/" & BASE_ID & "/" & TABLE_ID & "?view=" & VIEW_ID,
Headers = [Authorization = "Bearer " & PERSONAL_ACCESS_TOKEN]
]
)
)
else
// Subsequent API calls with offset
Json.Document(
Web.Contents(
"https://api.airtable.com",
[
RelativePath = "v0/" & BASE_ID & "/" & TABLE_ID & "?view=" & VIEW_ID & "&offset=" & [WebCall][Value][offset],
Headers = [Authorization = "Bearer " & PERSONAL_ACCESS_TOKEN]
]
)
),
Counter = [Counter] + 1 // Increment the counter for each iteration
],
each [WebCall]
),
1
),
in
#"Expanded Record Fields";
shared PERSONAL_ACCESS_TOKEN = "xxxxxxxxxx" meta [IsParameterQuery = true, IsParameterQueryRequired = true, Type = "Text"];
shared BASE_ID = "xxxxxxxxxxx" meta [IsParameterQuery = true, IsParameterQueryRequired = true, Type = "Text"];
shared TABLE_ID = "xxxxxxxxxx" meta [IsParameterQuery = true, IsParameterQueryRequired = true, Type = "Text"];
shared VIEW_ID = "xxxxxxx" meta [IsParameterQuery = true, IsParameterQueryRequired = true, Type = "Text"];
The text was updated successfully, but these errors were encountered: