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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Incompatible types for...
Power Apps
Unanswered

Incompatible types for comparison when comparing collection values with dropdown selection

(1) ShareShare
ReportReport
Posted on by 35

I have the following piece of code on the OnSelect when users click on a button to generate a report:

 

GeneratePDFProject.Run(User().Email,
JSON(
Filter(
'Projects',
colViews.ViewName = Dropdown.Selected.ViewName

),
IgnoreUnsupportedTypes & JSONFormat.IgnoreBinaryData
)
);

 

my Dropdown contains several collection values like 'my projects', ' all projects', etc... now I want to be able based upon the selection made in the Dropdown to produce  a report that is filtered based upon the selection.  

 

When I hoover over the = sign I keep on getting the following error message:

 

Incompatible types for comparison. These types can't be compared: Table, Text.

 

Appreciate any advise or solution for this. Thanks!

 

 

 

 

 

Categories:
I have the same question (0)
  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    Hi @BauwensER3 ,

     

    To get deeper into this issue would you please explain colViews.ViewName in your code. What this colViews.ViewName contains and is the ViewName column present in Projects ?

     

    Thanks 

  • BauwensER3 Profile Picture
    35 on at

    On the OnStart of the application I have the following piece of code:

     

    ClearCollect(
    colViews,

    {
    ViewName: "My Projects",
    ViewColumns: [
    "ID",
    "Title",
    "Requested by Section",
    "Point of Contact in Section",
    "Location of Work",
    "Brief description of the work",
    "Requested Start Date",
    "Estimated End Date",
    "Approval Status"
    ]
    },

    {
    ViewName: "All Projects",
    ViewColumns: [
    "ID",
    "Title",
    "Requested by Section",
    "Point of Contact in Section",
    "Location of Work",
    "Brief description of the work",
    "Requested Start Date",
    "Estimated End Date",
    "Approval Status"
    ]
    },

    {
    ViewName: "Pending Approval",
    ViewColumns: [
    "ID",
    "Title",
    "Requested by Section",
    "Point of Contact in Section",
    "Location of Work",
    "Brief description of the work",
    "Requested Start Date",
    "Estimated End Date",
    "Approval Status"
    ]
    },

    {
    ViewName: "Approved by MGT",
    ViewColumns: [
    "ID",
    "Title",
    "Requested by Section",
    "Point of Contact in Section",
    "Location of Work",
    "Brief description of the work",
    "Requested Start Date",
    "Estimated End Date",
    "Approval Status"
    ]
    },

    );
    Set(varSortColumn,"ID");
    Set(varSortDirection,Descending);
    Navigate(HomeScreen)

     

     

    For my datatable on Items I have the following code:

     

    Switch(
    Dropdown.Selected.ViewName,
    "My Projects",
    SortByColumns(
    Filter(
    'Projects',
    StartsWith(
    Title,
    SearchBox.Text
    ) && 'Created By'.Email = User().Email || StartsWith(
    'Brief description of the work',
    SearchBox.Text
    ) && 'Created By'.Email = User().Email || StartsWith(
    'Location of Work',
    SearchBox.Text
    ) && 'Created By'.Email = User().Email
    ),
    varSortColumn,
    varSortDirection
    ),
    "All Projects",
    SortByColumns(
    Search(
    'Projects',
    SearchBox.Text,
    "Title",
    "Briefdescriptionofthework",
    "LocationofWork"
    ),
    varSortColumn,
    varSortDirection
    ),
    "Pending Approval",
    SortByColumns(
    Filter(
    'Projects',
    StartsWith(
    Title,
    SearchBox.Text

    ) && 'Approval Status' = "Pending Approval"
    ),
    varSortColumn,
    varSortDirection
    ),
    "Approved by MGT",
    SortByColumns(
    Filter(
    'Projects',
    StartsWith(
    Title,
    SearchBox.Text
    ) && 'Approval Status' = "Approved by MGT"
    ),
    varSortColumn,
    varSortDirection
    )

     

  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    Hi @BauwensER3,

    Could you please  let me know the Dropdown items data also ?

  • BauwensER3 Profile Picture
    35 on at

    The items for the dropdown are basically the colViews

    DropDownItems.PNG
  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    Hi @BauwensER3 ,

     

    The issue seems due colViews.ViewName is a collection and dropdown.selected.ViewName is text 

     

    PriyankaMadan10_0-1627913661962.png

    So instead of using collection value in the Filter try using the Project column value. Let me know if further help required. 

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.  

  • BauwensER3 Profile Picture
    35 on at

    Sorry but are you implying that I need to make the change on the OnSelect Event? :

     

    GeneratePDFProject.Run(User().Email,
    JSON(
    Filter(
    'Projects',
    colViews.ViewName = Dropdown.Selected.ViewName

    ),
    IgnoreUnsupportedTypes & JSONFormat.IgnoreBinaryData
    )
    );

     

     

  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    Hi @BauwensER3,

     

    Instead of directly using colViews.ViewName in Filter is it possible to use any columns from Project datasource ? 

     

  • BauwensER3 Profile Picture
    35 on at

    ok, the only column that I could use from the project data source which is a SharePoint list is named

    'Approval Status' but I am not really interested in reports on the Approval Status. I want to be able to achieve that when users select "My projects" that it produces a report with only the projects that they submitted for approval, and when they select "All Projects" a report should be produced listing all of the projects submitted.

     

    This is what I have in Items on my datatable:

     

    Switch(
    Dropdown.Selected.ViewName,
    "My Projects",
    SortByColumns(
    Filter(
    'Projects',
    StartsWith(
    Title,
    SearchBox.Text
    ) && 'Created By'.Email = User().Email || StartsWith(
    'Brief description of the work',
    SearchBox.Text
    ) && 'Created By'.Email = User().Email || StartsWith(
    'Location of Work',
    SearchBox.Text
    ) && 'Created By'.Email = User().Email
    ),
    varSortColumn,
    varSortDirection
    ),
    "All Projects",
    SortByColumns(
    Search(
    'Projects',
    SearchBox.Text,
    "Title",
    "Briefdescriptionofthework",
    "LocationofWork"
    ),
    varSortColumn,
    varSortDirection
    ),
    "Pending Approval",
    SortByColumns(
    Filter(
    'Projects',
    StartsWith(
    Title,
    SearchBox.Text

    ) && 'Approval Status' = "Pending Approval"
    ),
    varSortColumn,
    varSortDirection
    )

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Try it out
    Filter(
    'colViews',
    ViewName = Dropdown.SelectedText.ViewName
    ),

     

    The sintax is:
    Filter(
    'tableName',
    columnName1 = DropdownName.SelectedText.columnName2
    ),

     

    columnName1 is the column name of the tableName you wanna compare.

    columnName2 is the column name of the table your dropdown uses as data source

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 541

#2
WarrenBelz Profile Picture

WarrenBelz 434 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 289

Last 30 days Overall leaderboard