cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kepcla
Helper I
Helper I

Changing color of the circle according to the value of the column in a Collection

Hi All!

When I try to evaluate a column condition of a collection to change the color of a circle, it doesn't work ...

Any idea how to refer to the collection?

Image.jpg

 

 

Thanks in advance

 

Regards

S

 

 

3 ACCEPTED SOLUTIONS

Accepted Solutions
mdevaney
Super User
Super User

@Kepcla 

PowerApps is having trouble understanding which row in the collection you want to check.  I believe you want it to look at the first one.  Replace DaysFinal.Item1 with the code below in both places.

 

First(DaysFinal).Item1

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

KennethNicasens
Resolver III
Resolver III

Hi Kepda,

 

You're changing the color based on the collection, does this only contains 1 item?

If yes: Power Apps does not know this and will check on the whole table which he can't determine if the value is "vacation".
You can solve this by using First(DayFinal).Item1

 

If this is not the case, you will have to find a workaround.
Can you provide a little more detail about the app?

 

Kind Regards,

Kenneth Nicasens

View solution in original post

@Kepcla 

 

You could solve this by doing the following:

In your collection you have the date. Based on this date you can do a lookup, problem is that you need to concatenate the date yourself.

Switch(
    LookUp(
        colEvents,
        Concatenate(
            Text(
                Day(
                    DateAdd(
                        _firstDayInView,
                        ThisItem.Value,
                        Days
                    )
                )
            ),
            "/",
            Text(Month(_firstDayOfMonth)),
            "/",
            Text(Year(_firstDayOfMonth))
        ) = Text(colDate)
    ).Item1,
    "Vacation",
    RGBA(56,96,178,0.2),
    "Work",
    RGBA(56,96,178,0.5 ),
    "Weekend",
    RGBA(56,96,178, 1),
RGBA(56,96,178,0.6 )
)

 
I would also do a switch instead of an If, this way you make it more Future proof.

View solution in original post

17 REPLIES 17
mdevaney
Super User
Super User

@Kepcla 

PowerApps is having trouble understanding which row in the collection you want to check.  I believe you want it to look at the first one.  Replace DaysFinal.Item1 with the code below in both places.

 

First(DaysFinal).Item1

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

KennethNicasens
Resolver III
Resolver III

Hi Kepda,

 

You're changing the color based on the collection, does this only contains 1 item?

If yes: Power Apps does not know this and will check on the whole table which he can't determine if the value is "vacation".
You can solve this by using First(DayFinal).Item1

 

If this is not the case, you will have to find a workaround.
Can you provide a little more detail about the app?

 

Kind Regards,

Kenneth Nicasens

the "items1" column could be vacations or work:

Collection.jpg

@Kepcla 

Yes, that's true.  But you cannot simply check to see if Items1 is equal to vacations or work because there are several rows and PowerApps doesn't know which row to check.

 

Which row do you want to check?

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Actualy all (Item1)....maybe ForAll function could work...

Kepla,

Can you give a bit more context of the use of this functionality.

ForAll will loop over each item and will do an action(s) within this loop.

Thanks to All,  "First" function works!

Sorry clumsiness!!😥

Is not working...

First function just evaluate the 1st record...

I tried LookUp, Filter, ForAll, and not luck...

My brain is hanging upside down😖


Can you give a bit more context of the use of this functionality?

You can create a gallery with each item and color the circle in for each record.
Or do you want to check if there is 1 vacation within the list? Then you can use the following formula: If(Empty(Filter(colName, item1 = "vacation")),RGBA(),RGBA())

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (4,449)