cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sperry1625
Solution Supplier
Solution Supplier

Component Property Values

I am writing a generic component that I want to use across the Power Apps I build.  I would like to set default values for these properties but in order to do that I need to know if the properties are empty.  For certain properties it is straight-forward, like strings.  But for others, not so much.  For example, I have several properties of type Color.  I want to know if a Color property was provided.  How can I do that?  IsEmpty(), IsBlank() and IsError() all return false.

 

Thoughts?

Regards,

-S

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@sperry1625 

When you create a component, you always need to set the default values for the properties of the component.  

So, if for example, you set a property with a default property of Red color, then you can always check to see if the value is still Red - if not, then it has been changed.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

2 REPLIES 2
RandyHayes
Super User
Super User

@sperry1625 

When you create a component, you always need to set the default values for the properties of the component.  

So, if for example, you set a property with a default property of Red color, then you can always check to see if the value is still Red - if not, then it has been changed.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
GarethPrisk
Resident Rockstar
Resident Rockstar

IsBlank(inputParam) does work, but you can also use IsBlankOrError to account for erroneous scenarios as well.

 

Keep in mind, when working with components:

  • When using the component editor, it will use the defaulted value for the property
    • You'll likely have a default value (either set by app, or by you)
    • It would return a value, in the component editor
  • Once added to a screen
    • Select the input property
      • Clear it
      • Set is as Blank()

 

For example, in the component editor

GarethPrisk_0-1607100536790.png

On a screen, with a value set

GarethPrisk_1-1607100567671.png

On a screen, with no value set

GarethPrisk_2-1607100600154.png

 

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 (2,942)