cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
akg1421
Helper I
Helper I

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

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
        )
1 ACCEPTED SOLUTION

Accepted Solutions
akg1421
Helper I
Helper I

Solved by using "ThisItem"

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

 

 

View solution in original post

8 REPLIES 8
WarrenBelz
Super User
Super User

@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.

@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
  }
)

 

 

@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.

@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"

@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.

 

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

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


akg1421_0-1627475944192.png

 

akg1421
Helper I
Helper I

Solved by using "ThisItem"

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

 

 

View solution in original post

@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.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,093)