cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Todd1561RPCI
Level: Powered On

Gallery data disappears

I have an app with 3 controls (date picker, combobox and dropdown list) that determine what data shows on 2 galleries on this screen.  I have another screen that allows you to select an item and that changes the values in the aforementioned 3 controls and therefore changes what shows in the 2 galleries.  Everything works fine in testing/dev environment.  But when I publish (web player or mobile device) about 40% of the time the 2nd gallery will be blank.  I can usually see the data flash up for a second and then disappears.  If I click on another control on this screen that has nothing to do with this gallery the contents will re-draw.  I have tried disabling all the advanced features (delayed load, non-blocking onstart rule, explicit column selection, improved app rendering) to no avail.  These galleries are populated by a sharepoint list and there are no delegation complaints.

 

What's odd is the first gallery never has a problem and while it's pointed to a different SP list it uses the same 3 keys of information to populate.  It's also worth noting that it's not always the same selection on the 2nd screen that fails to populate the 1st screen.  Sometimes the same selection will work, sometimes not.  Any idea what could be going on?  Let me know if I didn't describe this app well enough.

 

Thanks

4 REPLIES 4
Community Support Team
Community Support Team

Re: Gallery data disappears

Hi @Todd1561RPCI ,

 

Please share all the related formulas here so that we could try to reproduce your issue.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Todd1561RPCI
Level: Powered On

Re: Gallery data disappears

This app has grown to be pretty complex, I'm not sure how we'll I'll be able to convey all the relevant code in a forum setting like this, but I'll try.  Something to note, I've been playing around with this more and I found that by changing the ordering of the problematic gallery I'm able to change the behavior of the issue.  i.e when I selected "send to back" on the problematic gallery the problem then seemed to change to the first gallery that had no issue before.

 

Here's the Items source for the gallery in question, this is on the 'main screen':

Filter('DB-ForemanReport-EQ',
    rID = cboJobNum.Selected.rID,strDate =   Text(dteReportDate.SelectedDate) ,Foreman = cboForeman.Selected.UserName
    )

On the sub-screen I have another gallery (galReports) with this Items source:

Sort(
    Filter(
        'DB-ForemanReport',
        StartsWith(
            JobNum,
            dropMonitorDiv.Selected.DivNum
        ),
        StartsWith(
            PMUsername,
            dropMonitorPM.Selected.UserName
        ),
        (Score <> -1 && Score <> 1 && Score <> 2 && Score <> 3 && Score <> 4 && Score <> 5 && chkMonitorUnscored.Value && Status = "Final") || chkMonitorUnscored.Value = false,
        valReportDate >= DateDiff(
            DateValue("01/01/2018"),
            DateAdd(
               varToday,
                -60,
                Days
            )
        ),
        JobNum = cboMonitorJobFilt.Selected.Result || IsBlank(cboMonitorJobFilt.Selected.Result)
    ),
    ReportDate,
    Descending
)

When the user selects one of the items from 'galReports' this code runs (OnSelect event):

Set(
    varIsProgrammatic,
    true
);
Set(
    curForeman,
    LookUp(
        varForemanList,
        UserName = galReports.Selected.Foreman
    )
);
Set(
    varDefJob,
    Blank()
);
Set(
    varDate,
    galReports.Selected.ReportDate
);
ClearCollect(
    varTmpJobList,
    {
        JobNumAndName: "Please Select a Job",
        rID: "!TAN-PLACEHOLDER"
    }
);
Collect(
    varTmpJobList,
    Filter(
        'DB-ForemanReport',
        strReportDate = Text(galReports.Selected.ReportDate),
        Foreman = galReports.Selected.Foreman
    )
);
Set(
    varDefJob,
    First(
        Filter(
            'DB-ForemanReport',
            rID = galReports.Selected.rID,
            strReportDate = Text(galReports.Selected.ReportDate),
            Foreman = galReports.Selected.Foreman
        )
    )
);
If(
    galReports.Selected.Status = "Final",
    Set(
        varSaveBtnsVisible,
        false
    );
    Set(
        varSaveScoreVisible,
        true
    );
    Set(
        varCanEditSubForms,
        DisplayMode.Disabled
    );
    Set(
        varDraftBtnEnabled,
        DisplayMode.Disabled
    );
    Set(
        varSubmitBtnEnabled,
        DisplayMode.Disabled
    ),
    Set(
        varSaveBtnsVisible,
        true
    );
    Set(
        varSaveScoreVisible,
        false
    );
    Set(
        varCanEditSubForms,
        DisplayMode.Edit
    );
    Set(
        varDraftBtnEnabled,
        DisplayMode.Edit
    );
    Set(
        varSubmitBtnEnabled,
        DisplayMode.Edit
    )
);
Navigate(scrMain, ScreenTransition.Fade)

The above changes the 3 variables that are driving the gallery on the main screen and thus 60% of the time causes the gallery on the main screen to update.  The other 40% seems to flash the new data for a split second and then it disappears.

Todd1561RPCI
Level: Powered On

Re: Gallery data disappears

Well, I've come up with a ridiculous hack workaround to "fix" this problem until the underlying issue can be identified.  I created a global boolean variable called "varDummy" that gets created in the OnStart event and set to false.  I then added a 4th condition to the items source of the 2 galleries on the main screen like this:

varDummy = true || varDummy = false

So basically, it does nothing and the filter condition will always be true.  But it does allow me to change this variable and trigger the gallery to refresh.  So I then added a 1 second timer to the main screen that toggles this variable upon timer end.  The timer is started when someone selects an item from the gallery on the second screen.  The end result is you may see the contents flash like before but a second later the data repopulates immediately.

 

Another "fix" I found in testing is to run a Refresh() on the 2 datasources in play here, but that proved to be much slower and more expensive than my solution above.  I still don't consider this fixed and would like to find out what's really going on here, but at least my app is usable.

Todd1561RPCI
Level: Powered On

Re: Gallery data disappears

Anyone have any thoughts on this?

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,185)