cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PytByt
Level 8

Condition to check if the selected item in a Gallery thats already there in a Collection

Hi all..

 

I need to know a way for check if the selected item in my Gallery is already created in my Collection.

If the item is already in my Collection, then that specific items, shown and its datas populated in a text input or a form.

 

Is this requirement can be achieved with powerapps collection and formula?

If yes, please tell me how..

 

Thank you,

PytByt

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Condition to check if the selected item in a Gallery thats already there in a Collection

Hi @PytByt ,

Do you want to check if the selected item in your Gallery existed in your Collection already?

 

Firstly, if you want to use Edit form to save data into your Collection, I afraid that there is no way to achieve your needs in PowerApps currently.

As an alternative solution, you need to create separated Text Input boxes to collect the entry inputs, then patch the inputs into your Collection using Patch function.

 

I have made a test on my side, please take a try with the following workaround:

Set Default property of the TextInput1 box (which bind to Column1 in your Collection) to following:

If(
    Gallery1.Selected.PrimaryColumn in YourCollection.PrimaryColumn,
    LookUp(YourCollection, PrimaryColumn = Gallery1.Selected.PrimaryColumn).Column1
)

Set Default property of the TextInput2 box (which bind to Column2 in your Collection) to following:

If(
    Gallery1.Selected.PrimaryColumn in YourCollection.PrimaryColumn,
    LookUp(YourCollection, PrimaryColumn = Gallery1.Selected.PrimaryColumn).Column2
)

Set Default property of the TextInput3 box (which bind to Column3 in your Collection) to following:

If(
    Gallery1.Selected.PrimaryColumn in YourCollection.PrimaryColumn,
    LookUp(YourCollection, PrimaryColumn = Gallery1.Selected.PrimaryColumn).Column3
)

...

...

Note: The PrimaryColumn represents the Primary Column (which could identify one record uniquely) in your Collection, which used to compare with the PrimaryColumn in your Gallery. I assume that the PrimaryColumn in your Collection is populated with values from the PrimaryColumn in your Gallery.

 

More details about the LookUp function, please check the following article:

LookUp function

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

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.

View solution in original post

9 REPLIES 9
shailendra74
Level 10

Re: Condition to check if the selected item in a Gallery thats already there in a Collection

Hi @PytByt 

 

You can check as below:

 

If(!IsBlank( LookUp(myCollection, ID=gallery.Selected.ID,ID)), "VALUE AVAILABLE","NOT AVAILABLE")

 

// ID or any unique value 

 

Thanks.

PytByt
Level 8

Re: Condition to check if the selected item in a Gallery thats already there in a Collection

Hi @shailendra74 

 

Where exactly should i put those formula?

 

I mean, i want to do it like automatically or by a button pressed?

 

thanks,

pytbyt

shailendra74
Level 10

Re: Condition to check if the selected item in a Gallery thats already there in a Collection

Hi @PytByt 

 

As you need to check on Gallery.SelectedID, so onselect of gallery item you can check.

 

If you need to do automatically, how/where do you want to show the result.

 

Thanks.

PytByt
Level 8

Re: Condition to check if the selected item in a Gallery thats already there in a Collection

Okay @shailendra74 , i will try it.

 

I want to display and populated the collection data in a form if that possible, but, if its not possible i want to populate the collection data into multiple text box where they came from. (from text box input and back again into that text box)

thanks, 

pytbyt

shailendra74
Level 10

Re: Condition to check if the selected item in a Gallery thats already there in a Collection

Hi @PytByt 

 

Considering the gallery datasource is from a collection, 

 

  • add a new column and set the value to the formula

 

If(!IsBlank( LookUp(myCollection, ID=gallery.Selected.ID,ID)), "VALUE AVAILABLE","NOT AVAILABLE")

 

Thanks.

PytByt
Level 8

Re: Condition to check if the selected item in a Gallery thats already there in a Collection

@shailendra74 

 

what do you mean by:

  • add a new column and set the value to the formula 

 

and for the formula,

If(!IsBlank( LookUp(myCollection, ID=gallery.Selected.ID,ID)), "VALUE AVAILABLE","NOT AVAILABLE")

 

what should i put to replace "VALUE AVAILABLE" and "NOT AVAILABLE" for make it automatically populated in the current text box? 

 

i'm sorry for the troble.

 

BR,

pytbyt

shailendra74
Level 10

Re: Condition to check if the selected item in a Gallery thats already there in a Collection

Hi @PytByt 

 

What value you want to show if record available in both collection and gallery. You can assign that value.

 

 

 

Thanks.

PytByt
Level 8

Re: Condition to check if the selected item in a Gallery thats already there in a Collection


@shailendra74 wrote:

Hi @PytByt 

 

What value you want to show if record available in both collection and gallery. You can assign that value.

 

Thanks.


@shailendra74 

Its not a value that i want to show, but i need to distributes the content inside the collection. 

How am i supposed to achieve that?

 

thanks,

pytbyt

Community Support Team
Community Support Team

Re: Condition to check if the selected item in a Gallery thats already there in a Collection

Hi @PytByt ,

Do you want to check if the selected item in your Gallery existed in your Collection already?

 

Firstly, if you want to use Edit form to save data into your Collection, I afraid that there is no way to achieve your needs in PowerApps currently.

As an alternative solution, you need to create separated Text Input boxes to collect the entry inputs, then patch the inputs into your Collection using Patch function.

 

I have made a test on my side, please take a try with the following workaround:

Set Default property of the TextInput1 box (which bind to Column1 in your Collection) to following:

If(
    Gallery1.Selected.PrimaryColumn in YourCollection.PrimaryColumn,
    LookUp(YourCollection, PrimaryColumn = Gallery1.Selected.PrimaryColumn).Column1
)

Set Default property of the TextInput2 box (which bind to Column2 in your Collection) to following:

If(
    Gallery1.Selected.PrimaryColumn in YourCollection.PrimaryColumn,
    LookUp(YourCollection, PrimaryColumn = Gallery1.Selected.PrimaryColumn).Column2
)

Set Default property of the TextInput3 box (which bind to Column3 in your Collection) to following:

If(
    Gallery1.Selected.PrimaryColumn in YourCollection.PrimaryColumn,
    LookUp(YourCollection, PrimaryColumn = Gallery1.Selected.PrimaryColumn).Column3
)

...

...

Note: The PrimaryColumn represents the Primary Column (which could identify one record uniquely) in your Collection, which used to compare with the PrimaryColumn in your Gallery. I assume that the PrimaryColumn in your Collection is populated with values from the PrimaryColumn in your Gallery.

 

More details about the LookUp function, please check the following article:

LookUp function

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

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.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 194 members 6,387 guests
Please welcome our newest community members: