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
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))
Plz guide regarding this issue!
Update: Solved with
Category: LookUp(
'HSE-CategoryQuestion',
Question = QuestionLabel.Text,
ThisItem.Category
)
@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.
Solved by using "ThisItem"
Category: LookUp(
'HSE-CategoryQuestion',
Question = QuestionLabel.Text,
ThisItem.Category
)
@WarrenBelz It does not accept anything beyond Category , after dot
LookUp(
'HSE-CategoryQuestion',
Question=QuestionLabel.Text
).Category.Title
@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 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 ,
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 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
Here "Category" column expands to:
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 ,
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
146,603
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,946
Most Valuable Professional