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

Using an item data to color code filtered gallery

Hello all,

I have a new question/problem, if anyone could help me. I want to color code an icon I am using according to a field the data has, in this case, "completado", so when it is, for example, with value=1, it would be green, and if not, blue. However, the problem is that the gallery with code is:

GroupBy(Filter(galleryST.Selected.Subtareas, !IsBlank('Nombre Sub-Subtarea')),"Nombre_x0020_Sub-Subtarea", "SubSubtareas")

So I can't use something like "ThisItem.Completado" since the options "ThisItem" gives me are:

color1.png

Any way for me to use the value of the item in the gallery to color code it? That is one specific criteria, however I might need to use other info for IFs, which also cannot be 'called' from "ThisItem".

 

Addendum:
I also tried using: "ThisItem.SubSubtareas.Completado" however it seems I might not be using it correctly? Since the IF condition is giving error of "invalid argument type":

color2.png

Any input would be greatly appreciated,

 

EDIT:
Addendum 2:
Tried adding a label to check value/if it works, however it doesn't:

color3.png

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: Using an item data to color code filtered gallery

@FelipeCaru 

The reason you are seeing that situation is because SubTareas is a table within your Group.

There is no one specific Completado field - there are many of them. One for each record.

 

So the question would be - what would signify that all of the sub items in the group are complete?

 

If the signification of that is ALL of the sub items in Subtareas must be complete, then you need to check for that condition.

IF, as you mention, a value of 1 in the completado field indicates complete, then you can do a simple check like this:

   If(Sum(ThisItem.Subtareas, Completado)=CountRows(ThisItem.Subtareas), Green, Blue)

 

This will sum all of the values in the completado field in the sub items of your group and then compare that to the count of those rows.  If all rows are complete (completado=1) then the values will match and you can assume the group of items are complete.

 

I hope this is clear and helpful.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

FelipeCaru
Level 8

Re: Using an item data to color code filtered gallery

exampleColor.png

This is an example of how it would end, more or less, with a small icon with a condition ("completado"=1), if it says "tarea" (icon next to "Tarea") and the red clock due to being late.

In the end I checked the lookup I had for detail of gallery, and managed to retrieve the data I wanted by using:

exampleColorCode.png

@RandyHayes 

 

View solution in original post

8 REPLIES 8
Super User
Super User

Re: Using an item data to color code filtered gallery

@FelipeCaru 

The reason you are seeing that situation is because SubTareas is a table within your Group.

There is no one specific Completado field - there are many of them. One for each record.

 

So the question would be - what would signify that all of the sub items in the group are complete?

 

If the signification of that is ALL of the sub items in Subtareas must be complete, then you need to check for that condition.

IF, as you mention, a value of 1 in the completado field indicates complete, then you can do a simple check like this:

   If(Sum(ThisItem.Subtareas, Completado)=CountRows(ThisItem.Subtareas), Green, Blue)

 

This will sum all of the values in the completado field in the sub items of your group and then compare that to the count of those rows.  If all rows are complete (completado=1) then the values will match and you can assume the group of items are complete.

 

I hope this is clear and helpful.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

FelipeCaru
Level 8

Re: Using an item data to color code filtered gallery

 @RandyHayes 

Thank you for your prompt answer. That code actually works for my level above that, only that instead of sum would be an AVG=1. However, at the lowest detail, it would be an specific item, rather than the table. Is it possible with an item?

Super User
Super User

Re: Using an item data to color code filtered gallery

@FelipeCaru 

Yes, if your item in the gallery has a Completado field, then you can reference it in your Formula.  If (as in the original post) it does not show up as you type, then it is not in your Item.  The formula you supplied for the Items of the gallery suggests that your Gallery has a table with two fields, the Nombre_x0020_Subtarea, and SubSubtareas fields.  There are no other fields for that gallery.  ThisItem.xxxx will only show those two fields to choose from.

 

If you are suggesting that the Subtareas list has a Completado field, then you can adjust your formula as follows:

   If(galleryST.Selelected.Completado=1, Green, Blue)

In other words, you can usually go to the source of your groupby to get the answer you need.

 

I hope that is clear and helpful.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
FelipeCaru
Level 8

Re: Using an item data to color code filtered gallery

@RandyHayes 

Following the thread; been trying the formula -first one- you wrote, so far I think it does work for me. However, I have yet another user requirement/question as if "it is possible" or not, but this time it is coloring according to dates. I have some gallery that aren't filtered at all, so in those cases it is easy for me to use IF statement with the columns with dates, however, in filtered galleries such as in this case, how can I do this? or is it not possible?

dateComparison.png

This is the source Excel file. The first gallery shows only the Column A with the following:

GroupBy(Filter(Consolidado_Piloto_v4, Or(Lower(User().Email)=Lower('PowerApp Admin'), Lower(User().Email)=Lower('Responsable ARQ'), Lower(User().Email)=Lower('Responsable ING'), Lower(User().Email)=Lower('Responsable ING Vial'), Lower(User().Email)=Lower('Responsable PlaceHolder1')) && Len('Nombre Tarea')>0),"Nombre_x0020_Proyecto","Proyectos")

Then, selecting for example, "Limache" (row 2), takes to a gallery with the items of Column B, which has code:

GroupBy(Filter(galleryLP.Selected.Proyectos, !IsBlank('Nombre Tarea')), "Nombre_x0020_Tarea", "Tareas")

Then if selected takes to gallery with items in Column C, which has code:

GroupBy(Filter(galleryLT.Selected.Tareas, !IsBlank('Nombre Subtarea')),"Nombre_x0020_Subtarea", "Subtareas")

And then if selected takes to the last 'level' of Column D, which has code:

GroupBy(Filter(galleryST.Selected.Subtareas, !IsBlank('Nombre Sub-Subtarea')),"Nombre_x0020_Sub-Subtarea", "SubSubtareas")

Then, looking at the Excel sheet, you can see each row has both "Comienzo Plan" and "Fin Plan", and also having "Comienzo Real" and "Fin Real", which are inputted by the user (planned start/planned end/real start/real end date). With those dates, what I would need, is to compare them such as, for example:

  • If there is no "comienzo real" (real start), then -> compare planned start vs today()
    • This would give the icon I have in the galley a color according to result.
  • There IS "comienzo real", then -> compare planned end vs today
    • Again some color with result
  • There IS "fin real" -> compare planned end vs real end
    • Again some color with result

My problem in the case with the filtered/grouped by gallery is that it seems I can not use the date in the row because it is not in the groupby? Due to this I have to ask if it is possible what I want to do.

 

EDIT:

Code I tried but didn't work due to being grouped/filtered is:

DateDiff(ThisItem.SubSubtareas.'Comienzo Plan',Today(),Days)
Super User
Super User

Re: Using an item data to color code filtered gallery

@FelipeCaru 

Yes, this is all very possible to do.

The question I have is this, are you just talking about color coding in your final Gallery (the list of Sub-Sub Tareas) or are you wanting to do this at at some other level above that?  You have to remember, you are grouping, so, a group does not have other values, only records that belong to that group.

You mention that the Galleries (A, B, C, D) are all showing the group value.  At what point do you show actual data?  That would be where you can do your comparisons for color.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
FelipeCaru
Level 8

Re: Using an item data to color code filtered gallery

exampleColor.png

This is an example of how it would end, more or less, with a small icon with a condition ("completado"=1), if it says "tarea" (icon next to "Tarea") and the red clock due to being late.

In the end I checked the lookup I had for detail of gallery, and managed to retrieve the data I wanted by using:

exampleColorCode.png

@RandyHayes 

 

View solution in original post

Super User
Super User

Re: Using an item data to color code filtered gallery

@FelipeCaru 

So then you got working what you needed?  If so, that's great!

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
FelipeCaru
Level 8

Re: Using an item data to color code filtered gallery

@RandyHayes 

Yeah, I'll later mark it as solved/answer, but basically did a lookup for the source and condition was using the previous clicked gallery, in case there was more than one name but different 'parent', and so, with that lookup, retrieved the info I needed (:

Helpful resources

Announcements
thirdimage

Power Apps 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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (4,415)