cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Blair
Level: Powered On

If statement on table search

Hi Folks,

Trying to set a true or false value for a control in each gallery item if a collection item contains the GUID of the current GUID in the gallery. But I can only seem to work out how to search the first row in the collection:

 

If(First(SelectedProjectBenefits).Master_Benefit_ID exactin ThisItem.Master_Benefit_ID, true, false)


Removing the first says it cant search a table.
Wondering if anyone could point me in the right direction?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
AMerrill
Level 8

Re: If statement on table search

It seems like you would want:

If(ThisItem.Master_Benefit_ID in SelectedProjectBenefits.Master_Benefit_ID,true,false)

 

The difference between the two is that you have used "in" as a String operator (i.e. you are searching through a string for a substring). In the above code you are performing a table search to see, in this case, if the ID string is contained in the ID column of SelectedProjectBenefits.

 

Please let us know if you have any further questions.

2 REPLIES 2
AMerrill
Level 8

Re: If statement on table search

It seems like you would want:

If(ThisItem.Master_Benefit_ID in SelectedProjectBenefits.Master_Benefit_ID,true,false)

 

The difference between the two is that you have used "in" as a String operator (i.e. you are searching through a string for a substring). In the above code you are performing a table search to see, in this case, if the ID string is contained in the ID column of SelectedProjectBenefits.

 

Please let us know if you have any further questions.

Highlighted
Community Support Team
Community Support Team

Re: If statement on table search

Hi @Blair,

 

Do you want to check if the current GUID in the Gallery control is included within a Collection?

 

I agree with @AMerrill's thougt almost, if you want to check if the current GUID in the Gallery control is included within a Collection, please modify your formula as below:

If(ThisItem.Master_Benefit_ID in SelectedProjectBenefits.Master_Benefit_ID, true, false)

Note: I assume that you want to set a true value for a control when the current GUID in the gallery is included within a collection.

 

In addition, you could also take a try with the following formula within your app:

If(
IsEmpty(LookUp(SelectedProjectBenefits,Master_Benefit_ID=ThisItem.Master_Benefit_ID)),
false,
true
)

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 46 members 4,928 guests
Please welcome our newest community members: