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 800

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
    800 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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 552

#2
Valantis Profile Picture

Valantis 388

#3
11manish Profile Picture

11manish 375

Last 30 days Overall leaderboard