cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tris55
Frequent Visitor

Power Apps custom form: Update Field Value based on changes to other fields

Hi all,

 

I have a SharePoint list, using a custom form.

 

The list is of people (Clients), the "Title" field is a unique string, consisting of "Surname, Forenames (<Number if required due to duplicates>)" e.g. "Bloggs, Joe" or "Einstein, Albert (2)".

 

There are also fields for "Surname" and "Forenames". 

 

To avoid entering the data twice, I would like the Form to update the "Title" field automatically when the Surname and Forenames fields are updated. However, I want the Title form to remain visible for editing incase the user needs to add a number.

 

I can't work out how to "live" update the text in the "Title" datacard when the Surname or Forenames text fields are updated.

 

Any help is much apprecated.

 

Thanks,

 

Tristan

1 ACCEPTED SOLUTION

Accepted Solutions

Sure, I am assuming that you  are creating the record using a form.  In the form add the Title as a card.  The formula for the Default property of the Title is shown in red.  The Coalesce function is to retain the Parent.Default if the form is in Edit mode but if it is in New mode, then the Concatenated fields (in the example DataCardValue36.Text and DataCardValue37.Text are used in the formula. In my case, I used Today() as the date the record was created so that there was some data to show in the screenshot.  In your case, use the createdon field instead of Today().  I like your idea as there will always be a value in that field and it will have meaning so you will know if people with the same name have been in your list more recently._1.png

 

View solution in original post

9 REPLIES 9
Drrickryp
Super User II
Super User II

Hi @tris55 

It would be a bit tricky to write a formula that assigns an index number automatically, besides, it isn't meanful, Why not make the Title include the date of birth to differentiate duplicates. Then you could set the Default property to Concatenate(Surname,", ",Forename," ",dateofbirth)

tris55
Frequent Visitor

Hi @Drrickryp 

 

Thanks for the quick reply. Can you explain to me a bit more about your last sentence: 


@Drrickryp wrote:

Then you could set the Default property to Concatenate(Surname,", ",Forename," ",dateofbirth)


I don't have the person's date of birth, but I could use the date I am creating the record, or similar. The main requirement is that it's a meaningful ID as I'm using it in another list with a Lookup, so users need to know who they are selecting.

So, if I do that, i.e. I want to set my "Title" column to Concatenate(Surname,", ",Forename," ",dateCreated), do you mind explaining how I do that in PowerApps so that the Title column updates based on changes to the Surname and Forename columns?

Thank you

Sure, I am assuming that you  are creating the record using a form.  In the form add the Title as a card.  The formula for the Default property of the Title is shown in red.  The Coalesce function is to retain the Parent.Default if the form is in Edit mode but if it is in New mode, then the Concatenated fields (in the example DataCardValue36.Text and DataCardValue37.Text are used in the formula. In my case, I used Today() as the date the record was created so that there was some data to show in the screenshot.  In your case, use the createdon field instead of Today().  I like your idea as there will always be a value in that field and it will have meaning so you will know if people with the same name have been in your list more recently._1.png

 

View solution in original post

tris55
Frequent Visitor

Hey, thank you for this, the Coalesce function is something I've not seen before and super useful.

 

However, I must be doing something wrong. I've done as you suggested:

BrAPxmK

 

However, when I use the form in SP, the Title text box does not update when the others are updated, nor does the submitted item have a title made from the individual parts. 

 

Really appreciate your time; thank you.

 

@tris55 

First, set the form mode property to New instead of Edit. The formula I gave you is dynamic and will depend on the mode of the form, whether it is Edit or New.  If the form is in Edit mode, I think you are picking up the old value.  Also, you can try

 

 

Coalesce(Parent.Default,DataCardValue3.Text & ", " & DataCardValue4.Text & " - Created: " & Today()) 

 

 

instead of the Concatenation() function (the formulas are equivalent)  and see if that returns the right result.  Finally, check the Update property of the Title card to make sure it is picking up the correct name for the DataCardValue textbox inside the card. 

tris55
Frequent Visitor

Ah, just changing the mode property to New fixed it. Think I'll need to split out the forms between New, Edit, etc. to get it how I want, but that's one for another day!

 

Thanks again for all your help.

Drrickryp
Super User II
Super User II

Hi @tris55 

Thanks for the kudos but if it solved your question, then please accept it as a solution.

Drrickryp
Super User II
Super User II

Smilegif.gif

 

tris55
Frequent Visitor

No worries, I marked the most appropriate of your replies as the answer.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

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.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,898)