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

Help with IF statement in a Form Please

Hello everyone, I was hoping someone could help.

 

I have a form and i want to set the default of a card to one thing depending on if the form is in edit mode, and something else if its in new mode.

This is what I have, but nothing happens. Can anyone please help?

 

If(
FormCTRP.Mode.Edit = true,
Gallery2.Selected.Title_Batch.Text,
FormCTRP.Mode.New = true,
Text_Search.Text
)

 

Thank you in advance

1 ACCEPTED SOLUTION

Accepted Solutions
BCLS776
Super User
Super User

Try this:

 

If(FormCTRP.Mode = FormMode.Edit, Gallery2.Selected.Title_Batch.Text,FormCTRP.Mode = FormMode.New,Text_Search.Text)

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

View solution in original post

3 REPLIES 3
BCLS776
Super User
Super User

Try this:

 

If(FormCTRP.Mode = FormMode.Edit, Gallery2.Selected.Title_Batch.Text,FormCTRP.Mode = FormMode.New,Text_Search.Text)

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

View solution in original post

@BCLS776 

Thank you so much. That works. Thank you for saving my weekend!!

Drrickryp
Super User
Super User

@pricey79 

You can use the Coalesce() property to include the Parent.Default since this property will be blank if the form is new.  This can be put in the control's Default property inside the card.  If you did not want the user to be able to change it, then disable the card as well.  An alternative to disabling the card is to make the formula the Update property of the card and you can hide the card altogether.  I routinely do this when creating a foreign key from the ID in the parent gallery.  

 

Coalesce(Parent.Default,Text_Search.Text)

 

 

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,268)