Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Microsoft Dataverse
Unanswered

Dataverse view returns rows belonging to other owners in Power App gallery, despite (pre-)filtering

(0) ShareShare
ReportReport
Posted on by 15

I am not sure whether my query is mainly Dataverse related, or mainly Power Apps related. A similar question (958293) did not help, although it does provide useful comments and a solution to that question.

 

I have basic canvas app relying on two Dataverse tables (one is the built in Accounts table) and a few reusable options lists. The built in accounts table (with slight modification, called Organisationen (German), to which my Besuchsberichte (German for visitation reports) table is linked. Only owners should see their organisations, and therefor only the reports belonging to their organisations.

 

After other options did not work, I modified the active (default) view of the custom Besuchsberichte table to ensure it contains only the rows belonging to the logged in user. I even went a step further and defined that the logged in user must be both owner of the report and owner of the organisation. So far so good: the view displays the filtered list correctly.

 

Here a screenshot of the quickview panel of the view 'Aktive Besuchsberichte':

wildeH_0-1718007824961.png

Besitzer is German for owner.

 

I now use this view in a gallery with

  • a filter dropdown (see below - this is my problem),
  • a sort order reversal button (works), and
  • a three-option filter group* (works).

*The three options look at reports a) regardless of date sent, b) only without date sent c) only with date sent.

 

The first filter dropdown also attempts to cater for three scenarios:

  1. The user knows the organisation name and selects it from the drop-down: works
  2. the user (preferably one with elevated rights) wants to see orphaned reports (German ~ Weisen): works
  3. the user wants to see reports regardless of organisation: DOES NOT WORK AS EXPECTED

BTW: I do get delegation warnings on all levels of my Switch statement. The development team will have to look into this in years/months to come.

 

Here a screenshot of the screen showing a row that clearly belongs to my colleague (team leader).

 

wildeH_1-1718008982275.png

 

By now, you'll want to see my code. I could have tried to replace all custom German names using fictitious English names, but I am not sure that it will be a more productive way to explain my circumstances.

Ansichten = Views

Zeitpunkt = DateTimestamp

The code in red font is what I suspect to be containing a mistake.

 

Switch(ddOrganisation.Selected.Value;
    "Alle Organisationen";
    Sort(
        Filter(
            Besuchsberichte; 'Besuchsberichte (Ansichten)'.'Aktive Besuchsberichte';  
            (
                 !(Organisation.Organisation = Blank()) &&
                If(Radio1.Selected.Value=1; !(Organisation.Organisation = Blank()); If(Radio1.Selected.Value=2; 'Bericht gesendet am' = Blank(); !('Bericht gesendet am' = Blank())))
            )        
        ); Organisation.Organisation; If(varSortAsc; SortOrder.Ascending; SortOrder.Descending)
    );

    "...Weisen";        // orphans
        Sort(
            Filter(
                Besuchsberichte; 'Besuchsberichte (Ansichten)'.'Aktive Besuchsberichte ohne Org';
                (
                Organisation.Besitzer = LookUp(Teams;Match.Email=User().Email) &&
                Organisation.Organisation = Blank() &&
                If(Radio1.Selected.Value=1; true; If(Radio1.Selected.Value=2; 'Bericht gesendet am' = Blank(); !('Bericht gesendet am' = Blank())))                
                )
            );
            Zeitpunkt; If(varSortAsc; SortOrder.Ascending; SortOrder.Descending)
        );

        // default

        Sort(
            Filter(
                Besuchsberichte; 'Besuchsberichte (Ansichten)'.'Aktive Besuchsberichte';
                (
                    Organisation.Organisation = ddOrganisation.Selected.Value &&
                    If(Radio1.Selected.Value=1; true; If(Radio1.Selected.Value=2; 'Bericht gesendet am' = Blank(); !('Bericht gesendet am' = Blank())))
                )
            );
            Zeitpunkt; If(varSortAsc; SortOrder.Ascending; SortOrder.Descending
        )
    )
)
 
I am fairly limited in the views and field names allowed/suggested by the formula editor. For example, Organisation.Organisation does not belong to the reports table and is possible thanks to the relationship only.
 
I hope someone else sees what I am missing, because the last three weeks have really made me doubt Power Apps, Dataverse AND last but not least... my abilities.
Categories:
  • wildeH Profile Picture
    15 on at
    Re: Dataverse view returns rows belonging to other owners in Power App gallery, despite (pre-)filtering

    I cannot seem to edit my post, neither right after nor a few hours later. I want the second paragraph to read like this:

    I have a basic canvas app relying on two Dataverse tables (one is the built in Accounts table, with slight modification) and a few reusable options lists. The accounts table, called Organisationen (German for organisations), to which my Besuchsberichte (German for visitation reports) table is linked. Users should only see their own organisations, and therefor only the reports belonging to them and their organisations.

     

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Microsoft Dataverse

#1
mmbr1606 Profile Picture

mmbr1606 22 Super User 2025 Season 1

#2
stampcoin Profile Picture

stampcoin 17

#3
ankit_singhal Profile Picture

ankit_singhal 11 Super User 2025 Season 1

Overall leaderboard

Featured topics