cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
data_and_dogs
Frequent Visitor

Data table won't refresh

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

4 REPLIES 4
StalinPonnusamy
Super User
Super User

Hi @data_and_dogs 

 

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

Pstork1
Dual Super User
Dual Super User

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>) 

 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

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.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,396)