cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Neo2k
Frequent Visitor

Show columns in gallery based on a condition

Gurus,

 

Probably a simple question to answer - kindly help

 

I have table with 60 columns for e.g the table looks like below

 

Name  Process1  Process2 ..............  Process59

A            1              2                           0

B             4             0                          0

C              2              3                        1

 

In the powerapp - i have already got the name from the user..in our case if the user picks "A" then i want my gallery to only show the process columns where A has value greate than 0

 

in this case if "A" is selected then the gallery will only display Process 1 , process 2 and its value 

 

if the user selects "B" then only Process 1 will get displayed 

 

How do i go about achieving it - i know i have to play with filter - but how do i loop through all columns in the table to find value greater than 0 for the selected user??

 

Appreciate your help

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @Neo2k :

This feature requires a very lengthy formula to be realistic.I've made a test for your reference:

I assume the data type of PProcess1/2/……/59 are number.

1\Add a drop down control(Dropdown1) and set it's Items property to:

 

YourDataSource

 

2\Add a gallery and set it's  Items property to:

 

Filter([If(Dropdown1.Selected.Process1>0,"Process1"),If(Dropdown1.Selected.Process2>0,"Process2"),If(Dropdown1.Selected.Process3>0,"Process3"),If(Dropdown1.Selected.Process4>0,"Process4"),If(Dropdown1.Selected.Process5>0,"Process5"),If(Dropdown1.Selected.Process6>0,"Process6"),If(Dropdown1.Selected.Process7>0,"Process7"),If(Dropdown1.Selected.Process8>0,"Process8"),If(Dropdown1.Selected.Process9>0,"Process9"),If(Dropdown1.Selected.Process10>0,"Process10"),If(Dropdown1.Selected.Process11>0,"Process11"),If(Dropdown1.Selected.Process12>0,"Process12"),If(Dropdown1.Selected.Process13>0,"Process13"),If(Dropdown1.Selected.Process14>0,"Process14"),If(Dropdown1.Selected.Process15>0,"Process15"),If(Dropdown1.Selected.Process16>0,"Process16"),If(Dropdown1.Selected.Process17>0,"Process17"),If(Dropdown1.Selected.Process18>0,"Process18"),If(Dropdown1.Selected.Process19>0,"Process19"),If(Dropdown1.Selected.Process20>0,"Process20"),If(Dropdown1.Selected.Process21>0,"Process21"),If(Dropdown1.Selected.Process22>0,"Process22"),If(Dropdown1.Selected.Process23>0,"Process23"),If(Dropdown1.Selected.Process24>0,"Process24"),If(Dropdown1.Selected.Process25>0,"Process25"),If(Dropdown1.Selected.Process26>0,"Process26"),If(Dropdown1.Selected.Process27>0,"Process27"),If(Dropdown1.Selected.Process28>0,"Process28"),If(Dropdown1.Selected.Process29>0,"Process29"),If(Dropdown1.Selected.Process30>0,"Process30"),If(Dropdown1.Selected.Process31>0,"Process31"),If(Dropdown1.Selected.Process32>0,"Process32"),If(Dropdown1.Selected.Process33>0,"Process33"),If(Dropdown1.Selected.Process34>0,"Process34"),If(Dropdown1.Selected.Process35>0,"Process35"),If(Dropdown1.Selected.Process36>0,"Process36"),If(Dropdown1.Selected.Process37>0,"Process37"),If(Dropdown1.Selected.Process38>0,"Process38"),If(Dropdown1.Selected.Process39>0,"Process39"),If(Dropdown1.Selected.Process40>0,"Process40"),If(Dropdown1.Selected.Process41>0,"Process41"),If(Dropdown1.Selected.Process42>0,"Process42"),If(Dropdown1.Selected.Process43>0,"Process43"),If(Dropdown1.Selected.Process44>0,"Process44"),If(Dropdown1.Selected.Process45>0,"Process45"),If(Dropdown1.Selected.Process46>0,"Process46"),If(Dropdown1.Selected.Process47>0,"Process47"),If(Dropdown1.Selected.Process48>0,"Process48"),If(Dropdown1.Selected.Process49>0,"Process49"),If(Dropdown1.Selected.Process50>0,"Process50"),If(Dropdown1.Selected.Process51>0,"Process51"),If(Dropdown1.Selected.Process52>0,"Process52"),If(Dropdown1.Selected.Process53>0,"Process53"),If(Dropdown1.Selected.Process54>0,"Process54"),If(Dropdown1.Selected.Process55>0,"Process55"),If(Dropdown1.Selected.Process56>0,"Process56"),If(Dropdown1.Selected.Process57>0,"Process57"),If(Dropdown1.Selected.Process58>0,"Process58"),If(Dropdown1.Selected.Process59>0,"Process59")],Value<>Blank())

 

52.gif

This is the only option, because no formula can directly get the name of the field.

Best Regards,

Bof

View solution in original post

4 REPLIES 4
BrianS
Super User
Super User

Off the top of my head I would say you want to create collections and display those rather than the entire list. You could use ForAll to loop through the list and find the Zero values and exclude those from the collections - one for each "letter".
There certainly may be a more elegant solution. 

v-bofeng-msft
Community Support
Community Support

Hi @Neo2k :

This feature requires a very lengthy formula to be realistic.I've made a test for your reference:

I assume the data type of PProcess1/2/……/59 are number.

1\Add a drop down control(Dropdown1) and set it's Items property to:

 

YourDataSource

 

2\Add a gallery and set it's  Items property to:

 

Filter([If(Dropdown1.Selected.Process1>0,"Process1"),If(Dropdown1.Selected.Process2>0,"Process2"),If(Dropdown1.Selected.Process3>0,"Process3"),If(Dropdown1.Selected.Process4>0,"Process4"),If(Dropdown1.Selected.Process5>0,"Process5"),If(Dropdown1.Selected.Process6>0,"Process6"),If(Dropdown1.Selected.Process7>0,"Process7"),If(Dropdown1.Selected.Process8>0,"Process8"),If(Dropdown1.Selected.Process9>0,"Process9"),If(Dropdown1.Selected.Process10>0,"Process10"),If(Dropdown1.Selected.Process11>0,"Process11"),If(Dropdown1.Selected.Process12>0,"Process12"),If(Dropdown1.Selected.Process13>0,"Process13"),If(Dropdown1.Selected.Process14>0,"Process14"),If(Dropdown1.Selected.Process15>0,"Process15"),If(Dropdown1.Selected.Process16>0,"Process16"),If(Dropdown1.Selected.Process17>0,"Process17"),If(Dropdown1.Selected.Process18>0,"Process18"),If(Dropdown1.Selected.Process19>0,"Process19"),If(Dropdown1.Selected.Process20>0,"Process20"),If(Dropdown1.Selected.Process21>0,"Process21"),If(Dropdown1.Selected.Process22>0,"Process22"),If(Dropdown1.Selected.Process23>0,"Process23"),If(Dropdown1.Selected.Process24>0,"Process24"),If(Dropdown1.Selected.Process25>0,"Process25"),If(Dropdown1.Selected.Process26>0,"Process26"),If(Dropdown1.Selected.Process27>0,"Process27"),If(Dropdown1.Selected.Process28>0,"Process28"),If(Dropdown1.Selected.Process29>0,"Process29"),If(Dropdown1.Selected.Process30>0,"Process30"),If(Dropdown1.Selected.Process31>0,"Process31"),If(Dropdown1.Selected.Process32>0,"Process32"),If(Dropdown1.Selected.Process33>0,"Process33"),If(Dropdown1.Selected.Process34>0,"Process34"),If(Dropdown1.Selected.Process35>0,"Process35"),If(Dropdown1.Selected.Process36>0,"Process36"),If(Dropdown1.Selected.Process37>0,"Process37"),If(Dropdown1.Selected.Process38>0,"Process38"),If(Dropdown1.Selected.Process39>0,"Process39"),If(Dropdown1.Selected.Process40>0,"Process40"),If(Dropdown1.Selected.Process41>0,"Process41"),If(Dropdown1.Selected.Process42>0,"Process42"),If(Dropdown1.Selected.Process43>0,"Process43"),If(Dropdown1.Selected.Process44>0,"Process44"),If(Dropdown1.Selected.Process45>0,"Process45"),If(Dropdown1.Selected.Process46>0,"Process46"),If(Dropdown1.Selected.Process47>0,"Process47"),If(Dropdown1.Selected.Process48>0,"Process48"),If(Dropdown1.Selected.Process49>0,"Process49"),If(Dropdown1.Selected.Process50>0,"Process50"),If(Dropdown1.Selected.Process51>0,"Process51"),If(Dropdown1.Selected.Process52>0,"Process52"),If(Dropdown1.Selected.Process53>0,"Process53"),If(Dropdown1.Selected.Process54>0,"Process54"),If(Dropdown1.Selected.Process55>0,"Process55"),If(Dropdown1.Selected.Process56>0,"Process56"),If(Dropdown1.Selected.Process57>0,"Process57"),If(Dropdown1.Selected.Process58>0,"Process58"),If(Dropdown1.Selected.Process59>0,"Process59")],Value<>Blank())

 

52.gif

This is the only option, because no formula can directly get the name of the field.

Best Regards,

Bof

Thanks @v-bofeng-msft  : i thought about this then i was wondering powerapp should have easy way to loop through this instead of going through each rows. I will use this.

 

Since i have your attention - i have one more question regarding powerbi tile in power app - i have already raised a seperare question - but no answer there. 

 

Currently i am embedding the powerbi report in powerapp and thats the only way i can append the filter string URL and make it work. 

 

if i add the string url to my powerbi tile URL it keeps displaying the original report and not the filtered report...any thoughts

Hi @Neo2k :

I am afraid there is no easier way, because the data structure of your data source does not support it.

If you want this to be simple, I suggest you use this data structure:

NameProcessValue
AProcess11
AProcess22
 …… 
CProcess591

Of course, if you think this is troublesome, just use the solution I provided before.

If my post helps, then please consider Accept it as the solution to help others.

Best Regards,

Bof

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (6,147)