cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JamesNaylor
Regular Visitor

Concatenate multiple column values plus ID to create a new column value during new record

I'm trying to create a unique string that looks like this USA/F/IT&CL/100345.

I.e., (country code) / (foreign or domestic) / (department) / (series, planning to use the ID value)

 

This "number" needs to be created at the time the new record is created, in the 'Asset Tag" column, based on the values selected in other fields.

 

Where I'm getting stuck is where to do the concatenation?

And, if the record is new, how do I get the ID for the series number?

 

Thank you for any assistance!

 

Cheers, James

1 ACCEPTED SOLUTION

Accepted Solutions

@JamesNaylor Patch needs the datasource and the record that you want to modify. For syntax, see here, https://docs.microsoft.com/en-gb/powerapps/maker/canvas-apps/functions/function-patch#syntax

View solution in original post

8 REPLIES 8
CNT
Super User
Super User

@JamesNaylor If you are using SubmitForm() to create the new record, you can use the LastSubmit to get the ID of the last submitted record and then use it to create your string.

Hi CNT,

That sounds promising, thank you.

I'll keep you posted.

JamesNaylor
Regular Visitor

Hi CNT,

I can't find LastSubmit. Is it a property or a function?

Also, when and where would I use it? 

 

For testing I've tried the following command line on the form's 'OnSuccess' property. Although the record is added the 'Asset Tag' column doesn't get updated.

 

Patch('VS Asset Tags (tablet source)',Defaults('VS Asset Tags (tablet source)'),{'Asset Tag':"james"})

@JamesNaylor It's a function. After you submit the Form, in the OnSuccess property of the Form, you can do something like, yourForm.LastSubmit.ID

JamesNaylor
Regular Visitor

Thank you CNT...Funny, document search didn't find it.

 

I understand the approach, i.e., frmTagEntry.LastSubmit.ID returns the record ID...thank you for this tip.

 

But I'm stuck trying to simply update the field "Asset Tag", for the record just added.

 

I tried Patch({'Asset Tag': "12345"}) on the form's OnSuccess property, but no joy.

I'm struggling to find an example of updating a column of a record.

Any tips?

@JamesNaylor Patch needs the datasource and the record that you want to modify. For syntax, see here, https://docs.microsoft.com/en-gb/powerapps/maker/canvas-apps/functions/function-patch#syntax

JamesNaylor
Regular Visitor

Yes, I know what you're saying...I was just trying one of the examples from the docs.

"Patch( { Name: "Contoso", Phone: "1-212-555-1234" }, { Name: "Contoso", Location: "Midtown" } )"

 

But thanks to you I finally worked it out...it occurred to me that LastSubmit would bring the focus to the record I just created for Patch to work on.

 

Thank you very much for your assistance!

 

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Solution Authors
Top Kudoed Authors
Users online (3,351)