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
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

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.

Users online (5,529)