web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : BB/4GtxqrSicE0zPUhWqZG
Power Apps - Microsoft Dataverse
Unanswered

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

Like (0) ShareShare
ReportReport
Posted on 10 Jun 2024 09:03:54 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:
I have the same question (0)
  • wildeH Profile Picture
    15 on 10 Jun 2024 at 13:21:38
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 898 Most Valuable Professional

#2
Power Apps 1919 Profile Picture

Power Apps 1919 356

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 305 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics