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 Automate / Convert 1,2 o3 digit n...
Power Automate
Answered

Convert 1,2 o3 digit number to 4 character string

(1) ShareShare
ReportReport
Posted on by 742

Whats the best way to convert a 1 or 2 digit number to a 4 character string? -- I have an integer that can be 1,2 or 3 digits -- regardless of how big the number is I need to convert it to a 4 character string to the SharePoint column --- so if it was 1, convert to 0001 if its 12 convert to 0012 , 123, 0123 - has to end up 4 characters .... . started down this path as an expression in a Compose - got ugly ....

 


If(triggerOutputs()?['body/TransmitNo'],<10,concat('000',triggerOutputs()?['body/TransmitNo']),
If(triggerOutputs()?['body/TransmitNo'],<99,concat('00',triggerOutputs()?['body/TransmitNo']),
If(triggerOutputs()?['body/TransmitNo'],>99,concat('0',triggerOutputs()?['body/TransmitNo']),
triggerOutputs()?['body/TransmitNo'])))

Categories:
I have the same question (0)
  • Verified answer
    ctedesco3307 Profile Picture
    742 on at

    I got it   

     

    if(equals(length(string(triggerOutputs()?['body/TransmitNo'])), 1), concat('000',triggerOutputs()?['body/TransmitNo']),if(equals(length(string(triggerOutputs()?['body/TransmitNo'])), 2),concat('00',triggerOutputs()?['body/TransmitNo']),if(equals(length(string(triggerOutputs()?['body/TransmitNo'])), 3),concat('0',triggerOutputs()?['body/TransmitNo']),'no'))))

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!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 67

#2
David_MA Profile Picture

David_MA 64 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 39 Most Valuable Professional

Last 30 days Overall leaderboard