web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / concatenate number wit...
Power Apps
Answered

concatenate number with a text string, or convert number to text string

(0) ShareShare
ReportReport
Posted on by 497

I have a lot of occasions where I want to patch a single line of text with a combination of an ID column to generate some Service Code. I was hoping to use a simple Concatenate.

[Text-]-[Text-][ID]

 

I'm able to convert numbers to Text using Value()

Categories:
I have the same question (0)
  • Verified answer
    CarlosFigueira Profile Picture
    Microsoft Employee on at

    The function Value converts from text to numbers; you need to use the Text function instead. With that, you should be able to use the Concatenate function to do your concatenation:

    Concatenate("text1", "-", "text2", "-", Text(234))
  • nickduxfield Profile Picture
    497 on at

    Thanks Carlos, I tried that but initally encountered expectations of placeholders, as in Text Date syntax.

     

    The context is as follows.

    1. This is from a SharePoint list.
    2. It is a New Form that creates service codes.
    3. A simple concatenate together with the SharePoint Item ID, is simple.
    4. the elements that form part of the Concatenate are pulled from multiple lists, but am having trouble getting the ID, as it is autogenerated.
    5. Below are some methods I had to reach that point.

    Example service code

    SC-KBCE-ABA-66

    [SC-][CompanyABBR-][ServiceType-]-[ID]

     

    The method I added a Confirm Save step with a button so I could get the ID from the SharePoint list visible in a Text field. Then I would patch, if confirmed. WORKS

    Patch('Service Code',GalleryServiceCodes.Selected,{Title:Concatenate("SC-",LookUp(RegisteredClientsCollection,Company=DataCardValue7.Selected.Value,ShortCode),"-",LookUp(ServiceTypesCollection,DataCardValue75.Selected.Value=Title,ShortCode),"-", DataCardValue29.Text)});UpdateContext({ServiceCodesDisplayFormVisible:false,ServiceCodesGalleryVisible:true,ServiceCodesEditFormVisible:false,ServiceCodesSaveConfirmationVisible:false,NewServiceCode:false});ClearCollect(ServiceCodesCollection,'Service Code')

     

    My actual wish was to patch on the first save, but Text(IDon its own isn't recognised.

    Patch('Service Code',GalleryServiceCodes.Selected,{Title:Concatenate("SC-",LookUp(RegisteredClientsCollection,Company=DataCardValue7.Selected.Value,ShortCode),"-",LookUp(ServiceTypesCollection,DataCardValue75.Selected.Value=Title,ShortCode),"-", Text(ID))});UpdateContext({ServiceCodesDisplayFormVisible:false,ServiceCodesGalleryVisible:true,ServiceCodesEditFormVisible:false,ServiceCodesSaveConfirmationVisible:false,NewServiceCode:false});ClearCollect(ServiceCodesCollection,'Service Code')

     

    I tried to add specificity, but was wondering as Patch already was specific about which record I'm refering to in 'GalleryServiceCodes.Selected'. My new more specific code does work, but only on confirmation step, not in one step as in a New Form.

    Patch('Service Code',GalleryServiceCodes.Selected,{Title:Concatenate("SC-",LookUp(RegisteredClientsCollection,Company=DataCardValue7.Selected.Value,ShortCode),"-",LookUp(ServiceTypesCollection,DataCardValue75.Selected.Value=Title,ShortCode),"-", ID)});UpdateContext({ServiceCodesDisplayFormVisible:false,ServiceCodesGalleryVisible:true,ServiceCodesEditFormVisible:false,ServiceCodesSaveConfirmationVisible:false,NewServiceCode:false});ClearCollect(ServiceCodesCollection,'Service Code')

     

  • Verified answer
    CarlosFigueira Profile Picture
    Microsoft Employee on at

    If the ID is auto-generated when you create a new element in the NewForm(...), you should be able to get it on the OnSuccess action of the form, by looking at the LastSubmit property of the form - it contains the item that was created after submitting the form. From its description:

    LastSubmit â€“ The last successfully submitted record, including any server generated fields.

    • This property applies only to the Edit form control.
    • If the data source automatically generates or calculates any fields, such as an ID field with a unique number, the LastSubmit property will have this new value after SubmitForm successfully runs.
    • The value of this property is available in the OnSuccess formula.
  • nickduxfield Profile Picture
    497 on at

    Exactly, I love how these forms are setup with this OnSubmit and like.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 860

#2
Valantis Profile Picture

Valantis 548

#3
Haque Profile Picture

Haque 417

Last 30 days Overall leaderboard