Skip to main content
Community site session details

Community site session details

Session Id : FCXqyDv3XSvQUC7tBWnx+K
Power Apps - Building Power Apps
Unanswered

Can't convert text to a data entity (filter gallery on formula or collection)

Like (0) ShareShare
ReportReport
Posted on 19 Apr 2021 19:05:03 by 100

I have a formula that filters a table and returns a single column of it, all text. However, when I try to put that block of code (or a collection that returns the same data) into a filter statement to populate a gallery, it gives me the error in the title: "can't convert text to a data entity." All I'm trying to do is filter a gallery by whether one of its fields is in the list of returned data.

 

 

If(IsBlank(drpDropdown),
Filter(gallery code, field_1 in [a list of text values returned by the formula]),
Filter(gallery code, field_1 in drpDropdown.Selected.Result)
)

 

 

The second half of the formula, filtering by the dropdown selection, works fine. It's throwing an error on the second line. Field_1 is a text field, the returned data should also be text.

 

Update: if I use "field_1 in ColCollection.field_1", I get "invalid schema: expected a one-column table." Can I transform the one-column collection into a one-column table to use as a reference?

Categories:
  • RMDNA Profile Picture
    100 on 29 Apr 2021 at 15:38:46
    Re: Can't convert text to a data entity (filter gallery on formula or collection)

    Hi @v-qiaqi-msft. This will be a bit long, but I'm trying to include as much information as possible.

     

    Table 'Project Team Members' and the relevant fields:

    Display NameBackend NameData TypeNotes
    Bookable Resourcemsdyn_bookableresourceidLookupUse 'Bookable Resource'.Name
    Project Approvermsdyn_projectapproverYes/No 
    projectmsdyn_projectLookupUse project.'Project Name'

    From this, I want to get a list of all projects a user is approved on, where 'Bookable Resource'.Name = User ( ). That part is working fine, using a view where Approver is set to "Yes".

     

    ClearCollect(
    ColUserApprovals,
     Filter(
     'Project Team Members',
     'Project Team Members (Views)'.ApprovedProjects,
     'Bookable Resource'.Name = VarCurrentUser.FullName
     )
    )

     

    The real issue is filtering my gallery by those results. The gallery is built off a different table, ProjectName is a field in that table, also a lookup. When I try:

     

    Filter(
     [gallery code],
     Project.'ProjectName' in ColUserApprovals.project.'Project Name'
    )

     

    everything disappears.

     

    This is so confusing to me, because I've gotten each of the components to work separately. Using data tables for example:

    Unfiltered list of all projects in the gallery code:

    adsf.PNG

    List of projects I'm approved on: (these projects exist in the unfiltered list above):

    asdf2.PNG

    When I try using the filter I just wrote:

    asdf3.PNG

    I've got to be missing something. There's no reason this shouldn't work.

     

  • v-qiaqi@microsoft.com Profile Picture
    on 29 Apr 2021 at 07:01:36
    Re: Can't convert text to a data entity (filter gallery on formula or collection)

    Hi @RMDNA,

    Sorry for the late reply.

    Could you please share more about your Dataverse table, field type of 'Bookable Resource'?

    In addition, if you want to filter the Yes/No field, please refer to the following formula:

    Filter('Project Team Members','Project Approver'='Project Approver (Project Team Members)'.Yes)

    Please check if it could solve your problem.

    Regards,

    Qi

     

  • RMDNA Profile Picture
    100 on 26 Apr 2021 at 15:48:46
    Re: Can't convert text to a data entity (filter gallery on formula or collection)

    @v-qiaqi-msft just following up - any assistance on this?

  • RMDNA Profile Picture
    100 on 20 Apr 2021 at 15:33:22
    Re: Can't convert text to a data entity (filter gallery on formula or collection)

    Hi @v-qiaqi-msft - the basic table filter is below:

     

    Filter('Project Team Members',
     'Bookable Resource'.Name = VarCurrentUser.FullName &&
     'Project Approver' [=/in] "Yes"
    )

     

    Then I need to make a list of field_1 from the resulting filtered table to compare against. 

     

    The issue I run into is that the 'Project Approver' column in Dataverse is typed as a "Yes/No", which I've read PowerApps doesn't play nice with. If I use "=", it's an incompatible type, and if I use "in", it returns no data.

     

    If I can that field_1 list, I can drop it in the original formula below:

     

    If(IsBlank(drpDropdown),
    Filter(gallery code, field_1 in [the list of field_1 outputs above],
    Filter(gallery code, field_1 in drpDropdown.Selected.Result)
    )

     

  • v-qiaqi@microsoft.com Profile Picture
    on 20 Apr 2021 at 07:31:10
    Re: Can't convert text to a data entity (filter gallery on formula or collection)

    Hi @RMDNA,

    Could you please share your formula that filters a table and returns a single column of it?

    Actually, the returned result from the filter formula is a Table rather than a single column data.

    I want to confirm with you that if this field_1 is the returned data from your filter formula?

    If so, please just refer to the result from the filter formula:

    If(IsBlank(drpDropdown),
     [a list of text values returned by the formula].field_1 ,
    Filter(gallery code, field_1 in drpDropdown.Selected.Result)
    )

    If my understanding is incorrect, please correct me and provide more details.

    Regards,

    Qi

     

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 our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete