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

Datatable sometimes not displaying data

I am building an app that connects to a SQL database where customers from several different databases are merged together. I have queries that flag potentially incorrect merges, the app has one screen that shows the list as a datatable, and when you click an ID in the datatable it takes you to a screen with more detailed information about the customer merge. This click fires a Flow that fires off 3 different stored procedures - one for each datatable - and dumps the results in SQL tables.

 

The detail screen has 3 datatables: merge scores, cleaned demographics, and raw demographics. In the OnVisible of the details screen, I have Refresh(<Schema.Table>) for each of the 3 tables. I then have a timer for each that checks the table to see if it matches the active identifier, and not display the table until it does. The merges table works fine, the raw demographics table works fine 95% of the time, but the cleaned demographics table shows the NoDataText about 50% of the time. I can query the tables directly in SSMS and I get the correct data, so I don't know why it's not showing in my app datatable. Sometimes switching to showing the raw data then back to the cleaned data fixes the issue, but it's not reliable and I don't want my users to have to do that. 

 

Here's the code I have in the timer's OnTimerEnd property: 

 

 

If(LookUp('MultiVueAudit.CleanedDemographicsFromEDW',RecordCreationSEQ=1,EDWPatientID)=ActiveEDW,Set(CleanVisibleBM, true );Set(DemographicsLoadingVisibleBM, false);,'timer for cleaned table BM'.Reset);

 

 

So if the first record in the CleanedDemographics table has a PatientID that equals the PatientID selected on the previous page, it makes the table visible and turns off the loading image, and if it doesn't equal the selected PatientID, it starts the timer over. This is exactly the same way the other two datatables on this screen are set up, as well as the datatable on the list screen. It's acting like the cleaned data is ready because it's showing the datatable and hiding the loading image, but there are no rows in the datatable and it displays "We didn't find any data to show at this time". It does not seem to correlate with the number of rows it's bringing up.

 

Any help is appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
PTBBSolutions
Solution Supplier
Solution Supplier

Hi @data_and_dogs ,

 

Why are you refreshin the data sources? This is never a good idea. How many records (on average) you have in those tables - can't you put them in collections instead - you will increase the performance of your app drastically (not only in terms of speed).

View solution in original post

8 REPLIES 8
PTBBSolutions
Solution Supplier
Solution Supplier

Hi @data_and_dogs ,

 

Why are you refreshin the data sources? This is never a good idea. How many records (on average) you have in those tables - can't you put them in collections instead - you will increase the performance of your app drastically (not only in terms of speed).

There's usually somewhere between 3-12 records in each of those 3 tables. I haven't used PowerApps very extensively, so I'm not familiar with collections, but I'll look into using those instead. Thanks!

Hi @data_and_dogs ,

 

Let me know if you need help with collections and the overall set-up after you do your own research.

@PTBBSolutions 

I'm using collections for the data, and on the OnVisible of the detailed information screen, I have 

 

ClearCollect('coll Cleaned Data', 'MultiVueAudit.CleanedDemographicsFromEDW'); 
ClearCollect('coll Raw Data', 'MultiVueAudit.RawDemographicsFromEDW'); 
ClearCollect('coll Merge Scores', 'MultiVueAudit.MergeScoresFromEDW');

 

but for some reason, sometimes this is resulting in the collection having either the old data or no data. Is it possible that these are trying to do the ClearCollect before the source tables have updated (from the flow on the previous screen)? That's the only thing I can think of. I have confirmed each time that the source tables have the correct data. 

Hi @data_and_dogs ,

 

I would suggest to use the monitoring utility to see how exactly your app behaves and what time does each action require.

 

Additionally, I would collect the output of the flow (the flow's response) in a variable - this way you will make sure that no further actions will be executed prior the completion of the flow.

data_and_dogs
Frequent Visitor

@PTBBSolutions 

 

On the screen where the flow is being run, I am checking to make sure that the flow ran successfully before moving to the next screen. I have the code

 

Set(FlowResult, sp_ScoresAndDemographicsFromEDW.Run(ActiveEDW, ActiveEDW));
If(FlowResult = true, Navigate('EDW Search For Bad Merges', ScreenTransition.Cover));

 

so if I understand correctly, it shouldn't move to the next screen unless the flow completed successfully. (I know this could all be condensed into the If statement, but right now I want the variable for troubleshooting.) Am I doing this correctly?

 

I am using the monitor and that's how I'm seeing some of the issues. I run the flow, and it updates 3 SQL tables (I have confirmed that these all have the correct query results), then when it moves to the next screen, I have ClearCollect statements to pull the results from each table into a collection. Here's an example of what I'm seeing: 

data_and_dogs_0-1638197918191.png

Row 2 shows the flow running. For this particular selected ID, there should be 7 results. But 'coll Cleaned Data' (row 13) and 'coll Raw Data' (row 15) show a result of 2 rows, which are the results from the previous search. 

 

But a little further down (row 31) shows one collection that did update correctly.

data_and_dogs_0-1638203378266.png

 

So I'm not sure what I'm doing wrong. TIA

Hi @data_and_dogs ,

 

I would recommend to add

Set(FlowResult, Blank())

prior capturing the results of the flow - this will guarantee you that the variable will be reset prior every run.

 

As for the other part - Please try the following and see how it will behave:

1) On the OnVisible of you screen set a boolean variable (e.g. Set(StartTimer,true));

2) Add a timer control and set its AutoStart property to StartTimer

3) Make the duration of the timer = 1000 (1 sec)

4) Put your current (Screen) OnVisible formula (e.g. ClearCollect...) to the time control - OnTimerEnd

 

This will allow the tool to take 1 sec time before precalculating your collection.

 

Let me know if this helps.

This fixed the problem! Thank you so much, I really appreciate your help and your patience with helping me learn.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

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