Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This small PR updates the ExecuteQuery call so that all fields are returned in the result table, versus just the ones in the first row.
It's possible for the first object of the returned JSON to not include all possible columns. This can result in the following errors in Power Query:
![image](https://private-user-images.githubusercontent.com/1546593/403150465-bb53aa0c-d48a-40e6-b728-84e9ba890ca4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0ODY5OTYsIm5iZiI6MTczOTQ4NjY5NiwicGF0aCI6Ii8xNTQ2NTkzLzQwMzE1MDQ2NS1iYjUzYWEwYy1kNDhhLTQwZTYtYjcyOC04NGU5YmE4OTBjYTQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTNUMjI0NDU2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NThkZWVhODFlMzk0N2JlMjBjN2YyMzk3NDFlZTVlNDVkYjY2ODI3MDEzZTVlNWQyODlhZWI4N2M2NGIyNzAxMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ._JILzKoMXLHBV1YtdNLlAlwPo2BiclL6WUExfZwJfio)
![{E1241472-DE8C-4250-B043-11CF0758780D}](https://private-user-images.githubusercontent.com/1546593/403150579-47fd6ce7-2d77-4f5a-937a-9c0d0e83b2d7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0ODY5OTYsIm5iZiI6MTczOTQ4NjY5NiwicGF0aCI6Ii8xNTQ2NTkzLzQwMzE1MDU3OS00N2ZkNmNlNy0yZDc3LTRmNWEtOTM3YS05YzBkMGU4M2IyZDcucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTNUMjI0NDU2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YjY2NGUxZjA0NjUyMjUzMzExMDIyZDgwMmU4MzJmMGI1MWFkNzIwMjA5MjRiNGY3MTdkN2I5NmI0N2Q5ZGYxYSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.0k-HAXBAEVhDAQdROzMFaNFpNS_JbOLFtfMFr0Uq1jU)
In my case, when calling INFO.EXPRESSIONS(), the first two rows did not contain the QueryGroupID field, which caused the table to be created without it. The other rows then started to include it, causing them to error out.
This PR implements a solution similar to the one posted here, by first combining all of the records and pulling the distinct list of field names from the result. The records are then padded with any missing fields before returning the final result.
I'm guessing this is mostly applicable when running queries against INFO functions.