web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Turn visible true or f...
Power Apps
Unanswered

Turn visible true or false on Groupby Thisitem?

(0) ShareShare
ReportReport
Posted on by 235

Hey everyone,

 

I have another weird question. I have an app that has a Zip code population feature. Basically type a city in a textinput box then a gallery pops up that searches for that city. Select the correct city and it collects the info then populates all of the zip codes into another Textinput. 

Charliemacdmv_0-1652475010402.png

I have 2 icons for each item. "+" Add to Collection and "X" Delete from Collection. 

If Add is selected I want the "+" icon to go away and the "X" to appear. And vice versa. 

I can't seem to figure it out and I think it has to do with the Groupby function. Below is the gallery item code.

GroupBy(Filter(colZIP,StartsWith(city, TextInput2.Text)),"state_id","city","zip")

"+" onSelect

Collect(colZipCodes,ThisItem.zip);

Any thoughts?

Categories:
  • v-yujincui-msft Profile Picture
    Microsoft Employee on at

    Hi @Charliemacdmv ,

     

    Do you want two icons with opposite visibility?

    I have made a test for your reference.

     

    1. Select the Screen and apply the following formula on its OnVisible property as:

     

    Set(addvarvisible,true);Set(deletevarvisible,true)

     

    2. Select the Icon1 and apply the following formula on its OnSelect property as:

     

    Set(addvarvisible,false);Set(deletevarvisible,true);Set(varcurrentid,ThisItem.ID)

     

    ID is the unique identifying column in the data source.

    3. Select the Icon1 and apply the following formula on its Visible property as:

     

    If(varcurrentid=ThisItem.ID,addvarvisible,true)

     

    4. Select the Icon2 and apply the following formula on its OnSelect property as:

     

    Set(addvarvisible,true);Set(deletevarvisible,false);Set(varcurrentid,ThisItem.ID)

     

    5. Select the Icon2 and apply the following formula on its Visible property as:

     

    If(varcurrentid=ThisItem.ID,deletevarvisible,true)

     

    vyujincuimsft_2-1652770550788.png

    Result Screenshots:

    vyujincuimsft_0-1652770249622.png

    vyujincuimsft_1-1652770264585.png

     

     

    Best Regards,
    Charlie Choi

  • Charliemacdmv Profile Picture
    235 on at

    @v-yujincui-msft Thank you soo much for the reply. I will test it and get back. I really appreciate this. 

     

  • Charliemacdmv Profile Picture
    235 on at

    @v-yujincui-msft Thank you so much for that. It sorta worked. Actually it did work if I only wanted them to be able to add 1 selection. But they need to be able to add multiple selections. Any thoughts?

  • v-yujincui-msft Profile Picture
    Microsoft Employee on at

    Hi @Charliemacdmv ,

     

    Maybe you could try as below:

    1. Select the Screen and apply the following formula on its OnVisible property as:

    ClearCollect(currentid,Gallery1.AllItems.ID)

    2. Select the Icon1 and apply the following formula on its OnSelect property as:

    RemoveIf(currentid,ID=ThisItem.ID)

    ID is the unique identifying column in the data source.

    3. Select the Icon1 and apply the following formula on its Visible property as:

    If(ThisItem.ID in currentid.ID,true,false)

    4. Select the Icon2 and apply the following formula on its OnSelect property as:

    Collect(currentid,{ID:ThisItem.ID})

    5. Select the Icon2 and apply the following formula on its Visible property as:

    !Icon1.Visible

    vyujincuimsft_0-1652842820305.png

    Result Screenshot:

    vyujincuimsft_1-1652842868651.png

     

     

    Best Regards,
    Charlie Choi

  • Charliemacdmv Profile Picture
    235 on at

    @v-yujincui-msft thank you again. I appreciate your willingness to share your knowledge. I will give this a try.

  • Charliemacdmv Profile Picture
    235 on at

    @v-yujincui-msft That didn't quite work either. Unless i'm doing something wrong. Attached is only this part of the app. If you want to try and test it on your side. Right now it does what I want. Except I want the "X" to only be present if the items have been added. And if the items have been added I want the "+" to not be visible.

     

    Thanks!!!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 139

Last 30 days Overall leaderboard