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."

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

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,551)