Context:
The stored procedure works fine in Power Automate, but I encounter an issue in Power Apps when trying to store the result in a variable or collection. The error occurs when accessing .Table1 from the result set.
Power Fx Formula Where the Error Occurs:
I’ve tried using ParseJSON() to convert the result set to a typed object, but I still get the "Invalid argument type" error when trying to access fields from .Table1. Even when storing the result in a variable instead of a collection, I face the same issue.
Attempts to Resolve:
- I've tried using
Text(), Value(), and even ForAll() to convert and extract values from the result set, but I continue to encounter the error.
- I followed the documentation on handling untyped results, but still cannot properly parse the JSON data and store it in a variable.
Here’s an overview of what I’m doing:
- Retrieving JSON Data: I am calling a stored procedure and storing the JSON output in a variable:
- Extracting the Table from JSON Data:
3. Attempting to Parse and Store in a Variable:
However, I get the error message "Formula contains data where indent is expected" when trying to set the varTypedTable variable.
I have verified that varsiteproviders and varsiteprovidertable contain valid JSON data, and Power Automate successfully runs the same stored procedure. However, I’m trying to eliminate Power Automate due to performance concerns.
Expected Outcome:
I would like to store the result of the stored procedure in a Power Apps variable or collection and access the table’s fields without encountering the untyped object error.
Question:
How can I properly handle the stored procedure result in Power Apps to avoid this error? Should I convert the result into another format or use different Power Fx functions to handle the untyped object?
Any guidance or alternative approaches would be appreciated! Thank you.