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 / Can't Use Collection R...
Power Apps
Answered

Can't Use Collection Record On Fill

(0) ShareShare
ReportReport
Posted on by 23

OnStart:
ClearCollect(ColorScheme,{MainColor:"#003367",SecondaryColor:RGBA(0,51,103,1)});

Fill:
ColorValue(First(ColorScheme.MainColor))

or
First(ColorScheme.SecondaryColor)

I just didn't see what is the problem, here is the error msg "The property on this control expects color values the rule produces record values which are incompatible". It seems that First(ColorScheme.MainColor) is a record type, but I see no way to convert it to Text or Color type. My goal is to create a color scheme for my apps, can somebody help me?

 
Categories:
  • mdevaney Profile Picture
    29,993 Moderator on at

    @fxavier 

    Use this code instead

     

    ColorValue(First(ColorScheme).MainColor)

     

    Or this code:

     

    First(ColorScheme).SecondaryColor

     

    ---

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

  • KrishnaV Profile Picture
    5,023 on at

    Hi @fxavier ,

     

    As @mdevaney suggested use First(ColorScheme).SecondaryColor  or LookUp(ColorScheme,true,SecondaryColor) but the fill does not support the #hexa value it has to be RGBA value. Having said that it works with your second value of the collection.

     

    Change your collection as ClearCollect(ColorScheme,{MainColor:RGBA(255,51,103,1),SecondaryColor:RGBA(0,51,103,1)}); to make it work for both the scenarios.

     

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

    Regards,
    Krishna

  • Verified answer
    v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @fxavier ,

    Do you want to set fill based on value in collection?

    Firstly, let me explain where's your problem.

    First(ColorScheme.MainColor)   and     First(ColorScheme.SecondaryColor)

    represent a  record, not a value.

    You need to use formula like this: First(table).fieldname to represent a value.

    What's more, you need to fill in a value in ColorValue function, not a record.

    Try this:

    OnStart:
    ClearCollect(ColorScheme,{MainColor:"#003367",SecondaryColor:RGBA(0,51,103,1)});

    Fill:
    ColorValue(First(ColorScheme).MainColor)

    or
    First(ColorScheme).SecondaryColor

     

     

    Best regards,

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 345 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 312

#3
Mohsin Ali Profile Picture

Mohsin Ali 252

Last 30 days Overall leaderboard