I have a canvas app where on one screen I have a data table connected to a SQL server table, which pulls a list of values. When I select a value in that list, it's supposed to take me to another screen that runs a stored procedure, drops the results into a table, and displays the values from the table. Everything except "displays the values from the table" is working.
I know the stored procedure is running and dropping the results into the table, because I can see them when I query the database directly. But the data in the data table on the second screen doesn't change. In my 'OnVisible' property for the screen I have
<flowname>.Run(variable, variable); Refresh(<tablename>)
but it isn't working as I hoped.
I tried moving both commands to the 'OnSelect' of the first screen which navigates to the second, but I still get the old results in the data table.
Then I tried setting a timer so the data table didn't show until after the flow had run and after the table refresh, but that didn't work as I hoped either.
I don't have a ton of experience with PowerApps, so I suspect it's something I'm doing wrong.
Any help would be appreciated.
Solved! Go to Solution.
OK, So then you mean you are binding the Data table in Power Apps to a SQL table generated by the stored procedure. If that is the case then you need to refresh the data source for the data table, not the Data table itself.
The problem with this approach is Timing since Power Automate is an Async operation in which Your request moves to a queue and the operation takes in order.
But the Refresh(Table) is running before the Save data is completed.
A better option is your Flow (Power Automate) needs to return some status. Based on the status you may refresh the Table like
Set(FlowStatus, <flowname>.Run(variable, variable));
If(FlowStatus="Success",
Refresh(<tablename>)
)
Thanks,
Stalin - Learn To Illuminate
How are you loading the results from the stored procedure into the table? Normally, the results are returned in a JSON array that is stored in a collection and the collection is then used for a gallery or a table data source. But you aren't showing anything in your command to take the results of the flow run and store them in a collection. It should look more like this. <DataCollection> would then be used as the Items setting for the table.
ClearCollect(<DataCollection>,<flowname>.Run(variable, variable)); Refresh(<tablename>)
The stored procedure inserts the results into a sql table. So the end of the stored proc is
INSERT INTO dbo.schema.table
SELECT.....
there will be cases where I need the data in the sql table to use it for other tasks. The stored proc is working as intended, when I query it directly in SSMS, I get the results I expect.
OK, So then you mean you are binding the Data table in Power Apps to a SQL table generated by the stored procedure. If that is the case then you need to refresh the data source for the data table, not the Data table itself.
User | Count |
---|---|
262 | |
110 | |
92 | |
54 | |
44 |