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

Set Default value for choice field if it is blank

Hi PowerApps Community,

 

I have a canvas app with Edit Form which is connected to a SharePoint list. There is a choice field on the from whose default value needs to be set to one of the choice options if its blank. 

 

It works, when the 'Default" property of the datacard is set to the following expression.

LookUp(Choices('LisName'.'ChoiceFieldName'),Value="DefaultChoiceOption")

The requirement is to set default value only when the field is blank. 

Using if condition to check if the datacardvalue is blank/empty results in "this rule creates a circular reference" error.

 

Looking for help to get the above accomplished. 

 

Thanks,

SV

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

@sunithav 

Try this code instead:

 

If(ThisItem.ChoiceFieldName.Value=Blank(), {Value: "Default Text"}, ThisItem.ChoiceFieldName)

 

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

4 REPLIES 4
Super User III
Super User III

@sunithav 

Try this code instead:

 

If(ThisItem.ChoiceFieldName.Value=Blank(), {Value: "Default Text"}, ThisItem.ChoiceFieldName)

 

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

@mdevaney, Thanks for the response. I see error "Invalid argument type" in the expression for '=' operator.

@sunithav 

I have edited my code above to include .Value.  Please try it instead.

 

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

@mdevaney, That worked like a charm. Thank you very much.   

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (6,337)