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

Conditional default on choice field using Form modes

Hi,

I have a multiple selection choice field for which I want to execute below scenarios for default value :-

  • when form mode is New- it should give default value as N/A 
  • When form mode is View or Edit - It should depict the values selected by the user (if any ) and if the user has not selected any choice, it should use default value 'N/A'

I have used below configuration but it is not working correctly

DefaultSelectedItems:- If(
Form2.Mode = FormMode.New,
{Value : "N/A"}, (Form2.Mode = FormMode.View or Form2.Mode = FormMode.Edit) and DatacardValue10.Value =Blank(),{Value : "N/A"} , DatacardValue10.SelectedItems
)

But the above formula is not working as it is giving error expected record value.

Update :- DatacardValue10.SelectedItems

Default:- "N/A"

Any Suggestions ?

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @bondsharma56 ,

Try this in DefaultSelectedItems - change to your field name

If(
   Form2.Mode <> FormMode.New && !IsEmpty(ThisItem.ChoiceFieldName),
   ThisItem.ChoiceFieldName,
   {Value: "N/A"}
)

 

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.

Visit my blog Practical Power Apps

View solution in original post

9 REPLIES 9
Jeff_Thorpe
Super User
Super User

Is DefaultSelectedItems the property of DatacardValue10? 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

Hi @Jeff_Thorpe ,

Yes, DefaultSelectedItems is a  property of the choice field i.e field10 having DatacardValue10.

Jeff_Thorpe
Super User
Super User

If DefaultSelectedItems is a property of DatacardValue10 then the formula should be giving you circular reference error related to DatacardValue10.SelectedItems. Instead of DatacardValue10.SelectedItems use Parent.Default

The parent card should have the Default property set to ThisItem.FieldName



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

The above solution is not working.

 

DefaultSelectedItems:- If(
Form2.Mode = FormMode.New,
{Value : "N/A"}, (Form2.Mode = FormMode.View or Form2.Mode = FormMode.Edit) and DatacardValue10.Value =Blank(),{Value : "N/A"} , Parent.default
)

 

May be I have misunderstood the solution. Can you please ellaborate what should be present in Default and DefaultSelectedItems property

Hi @bondsharma56 ,

Try this in DefaultSelectedItems - change to your field name

If(
   Form2.Mode <> FormMode.New && !IsEmpty(ThisItem.ChoiceFieldName),
   ThisItem.ChoiceFieldName,
   {Value: "N/A"}
)

 

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.

Visit my blog Practical Power Apps

WarrenBelz
Super User
Super User

Hi @bondsharma56 ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

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.

Visit my blog Practical Power Apps

Hi @WarrenBelz , 

It is working when we use Table ({Value: "N/A"}) instead of {Value: "N/A"} as it is a multiple choice column (It was expecting a table value instead of single value)

@bondsharma56 ,

Yes - you did not mention a multi-choice column.

@WarrenBelz ,

 Thankyou for the Solution but I did mention that in my very initial description itself. Please find below description sample from my initial query :-

I have a multiple selection choice field for which I want to execute below scenarios for default value :-

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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,423)