Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

"Incompatible Types for Comparison: Table, Text" Error when comparing Gallery "Label.Text" with List column in LookUp function

(1) ShareShare
ReportReport
Posted on by 195

When comparing "Label.Text" from a gallery with List column in "LookUp" function it gives error Incompatible Types for Comparison. These types can't be compared:Table, Text

 

Formula:

 

 

Collect(
 HSEScoreValues,
 {
 Project_Name: Value(DataCardValue1.Selected.Value),
 Survey_Date: DataCardValue2.SelectedDate,
 Category:LookUp('HSE-CategoryQuestion','HSE-CategoryQuestion'.Question=QuestionLabel.Text,'HSE-CategoryQuestion'.Category)
 }
)

 

 

 

In above LookUp formula:

 

HSE-CategoryQuestion is the list with text(choice) columns "Question" & "Category"

QuestionLabel is Text Label in Gallery connected to the list "HSE-CategoryQuestion" fetching the "Category"  column values

 

so Error occurring here:

 

LookUp('HSE-CategoryQuestion','HSE-CategoryQuestion'.Question=QuestionLabel.Text,'HSE-CategoryQuestion'.Category)

 

'HSE-CategoryQuestion'.Question=QuestionLabel.Text

 

akg1421_0-1627449915966.png

 

What's the work around? @RandyHayes @WarrenBelz @Pstork1 @rubin_boer @CNT @BCLS776 @zmansuri @Drrickryp @timl @Ramole @BCBuizer 

Edit: I tried with 

 

LookUp('HSE-CategoryQuestion',Question=QuestionLabel.Text,'HSE-CategoryQuestion'.Category)

 

It stores "Category" as Table like data in collection.... "Category" column expands to multiple rows of Category. Also Project_Name is empty (in above function Project_Name: Value(DataCardValue1.Selected.Value))

 

akg1421_0-1627457933693.png


Plz guide regarding this issue!

Update: Solved with 

Category: LookUp(
 'HSE-CategoryQuestion',
 Question = QuestionLabel.Text,
 ThisItem.Category
 )
  • WarrenBelz Profile Picture
    146,603 Most Valuable Professional on at
    Re: "Incompatible Types for Comparison: Table, Text" Error when comparing Gallery "Label.Text" with List column in LookUp function

    @akg1421 ,

    That is not obvious from the information in your post - you must be running the button or icon code from inside a form or gallery for that reference to be possibly valid and your last post was even more confusing as you had a field Title in the metadata of the category table (you posted HSEScoreValues.Category which showed this). The error also reflected that this was a table incompatible Types for Comparison. These types can't be compared:Table, Text.

    I am glad you got it sorted, but the solution required more information than provided at the time.

  • Verified answer
    amk1421 Profile Picture
    195 on at
    Re: "Incompatible Types for Comparison: Table, Text" Error when comparing Gallery "Label.Text" with List column in LookUp function

    Solved by using "ThisItem"

    Category: LookUp(
     'HSE-CategoryQuestion',
     Question = QuestionLabel.Text,
     ThisItem.Category
     )

     

     

  • amk1421 Profile Picture
    195 on at
    Re: Incompatible Types for Comparison: Table, Text when comparing Gallery "Label.Text" with List column in LookUp function

    @WarrenBelz It does not accept anything beyond Category , after dot

    LookUp(
     'HSE-CategoryQuestion',
     Question=QuestionLabel.Text
     ).Category.Title


    akg1421_0-1627475944192.png

     

  • WarrenBelz Profile Picture
    146,603 Most Valuable Professional on at
    Re: Incompatible Types for Comparison: Table, Text when comparing Gallery "Label.Text" with List column in LookUp function

    @akg1421 ,

    From your output (which is strange) try

    Collect(
     HSEScoreValues,
     {
     Project_Name: Value(DataCardValue1.Selected.Value),
     Survey_Date: DataCardValue2.SelectedDate,
     Category:
     LookUp(
     'HSE-CategoryQuestion',
     Question=QuestionLabel.Text
     ).Category.Title
     }
    )

     

    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.

     

  • amk1421 Profile Picture
    195 on at
    Re: Incompatible Types for Comparison: Table, Text when comparing Gallery "Label.Text" with List column in LookUp function

    @WarrenBelz With both formulas its error "Function LookUp has some invalid arguments" 

    LookUp(
     'HSE-CategoryQuestion',
     Question=QuestionLabel.Text
     ).Category.Value
    LookUp(
    		 'HSE-CategoryQuestion',
    		 Question=QuestionLabel.Text,
    		 Category.Value
    )

     

    It is not accepting "Category.Value" because Category is the list column (choice field). But in powerapps shouldn't it be returning only "texual" values? For example Category was "Some category" and in Lookup we match it with QuestionLabel.Text so it should return first matching record from Category column i.e. value "Some category"

  • WarrenBelz Profile Picture
    146,603 Most Valuable Professional on at
    Re: Incompatible Types for Comparison: Table, Text when comparing Gallery "Label.Text" with List column in LookUp function

    @akg1421 ,

    Assuming Category in 'HSE-CategoryQuestion' is a Choice field

    Collect(
     HSEScoreValues,
     {
     Project_Name: Value(DataCardValue1.Selected.Value),
     Survey_Date: DataCardValue2.SelectedDate,
     Category:
     LookUp(
     'HSE-CategoryQuestion',
     Question=QuestionLabel.Text
     ).Category.Value
     }
    )

    or

    Collect(
     HSEScoreValues,
     {
     Project_Name: Value(DataCardValue1.Selected.Value),
     Survey_Date: DataCardValue2.SelectedDate,
     Category:
     LookUp(
     'HSE-CategoryQuestion',
     Question=QuestionLabel.Text,
     Category.Value
     )
     }
    )

     

    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.

  • amk1421 Profile Picture
    195 on at
    Re: Incompatible Types for Comparison: Table, Text when comparing Gallery "Label.Text" with List column in LookUp function

    @WarrenBelz I tried with: 

    Collect(
     HSEScoreValues,
     {
     Project_Name: Value(DataCardValue1.Selected.Value),
     Survey_Date: DataCardValue2.SelectedDate,
     Category:LookUp('HSE-CategoryQuestion',Question=QuestionLabel.Text,'HSE-CategoryQuestion'.Category)
     }
    )

    It stores data in collection but in "Category" it is storing a "table" like data and "Project_Name" is blank whereas DataCardValue1.Selected.Value is from dropdown and it is picking up the selected value

     

    Snap 2021-07-28 at 12.09.55.png

     

    Here "Category" column expands to:

    akg1421_1-1627456653380.png

     

     

    Your suggested formula is not returning anything the collection stays empty

     

    Collect(
     HSEScoreValues,
     {
     Project_Name: Value(DataCardValue1.Selected.Value),
     Survey_Date: DataCardValue2.SelectedDate,
     Category:
     LookUp(
     'HSE-CategoryQuestion',
     Question=QuestionLabel.Text
     ).Category
     }
    )

     

     

  • WarrenBelz Profile Picture
    146,603 Most Valuable Professional on at
    Re: Incompatible Types for Comparison: Table, Text when comparing Gallery "Label.Text" with List column in LookUp function

    @akg1421 ,

    Try this for a start

    Collect(
     HSEScoreValues,
     {
     Project_Name: Value(DataCardValue1.Selected.Value),
     Survey_Date: DataCardValue2.SelectedDate,
     Category:
     LookUp(
     'HSE-CategoryQuestion',
     Question=QuestionLabel.Text
     ).Category
     }
    )

     

    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.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,603 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,946 Most Valuable Professional

Leaderboard