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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Apps
Unanswered

LEN & Numbers

(0) ShareShare
ReportReport
Posted on by 204

Hi Team,

 

I need to get the LEN of the item in my gallery which i'm doing by Len(ThisItem.Test).

 

Whatever the LEN returns say its 5 i need to have a 5 0's with a leading 1 Example (100,000)

If the LEN was 4 then (1,0000)

 

I just cant figure out how to convert the LEN into the number of 0's.

 

Any help is greatly appreciated.

 

Thanks

Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,323 Super User 2025 Season 2 on at

    Hi @christian12 

     

    Ok now you could build this with a loop and some other things (especially if you create a custom control) but here is a little trick I made up, at least as far as I know, haven't seen it anywhere.

     

    I want you to create a TextLabel control, called it GetNumber. Make it invisible.

    For the Text value type in 10000000000 with 10 zeros, or if you need 20 zeros add 20 zeros. 

     

    Now when you get Len(ThisItem.Test) you want to add + 1 to it, so if the Len = 5 now make it 5 + 1, so 6.

    Let me explain. You said the Len is the # of zeros, and then you add a 1 to the beginning when makes the true len + 1

     

    Now lets say that you want to set another Text control to the value of Len(ThisItem.Test) to bla bla 100000.

    In the Text property of that control

    Type this code

    If(!IsBlank(ThisItem.Test), Left(GetNumber.Text, Len(ThisItem.Test) + 1),"")
    
    And it will return a number that is 1 + Len(ThisItem.Text) 0's...
    Note: I don't know what ThisItem.Test IS so IsBlank could be wrong to use there. but this will help insure you dont have any errors when ThisItem.Test is blank or empty or whatever you need to check
    
    :-)

     

    NOTE, if this is a Gallery, you do not have to add this invisible box to the Gallery, it just needs to be accessible 🙂 to the gallery controls, so as long as its on the screen. no worries.

     

    In my Sample here, I put a 1 and 30 zeros. And my GetNumbers Label is NOT invisible so you could see. 

    I put a TextInput, that I can type into

    I have another label under the GetNumbers, but it has no data yet because its Text property is set to this

    If(!IsBlank(InputStringToGetLenFrom.Text), Left(GetNumber.Text, Len(InputStringToGetLenFrom.Text) + 1),"")

    FLMike_0-1696479543936.png

    Now as I type

    FLMike_1-1696479607368.png

    Now I type 5 characters

    FLMike_2-1696479629402.png

     

    I hope this helps and if so please maybe Kudo and Set as Resovled for me.

    Thanks!


    Cheers
    If you like my answer, please Mark it as Resolved, and give it a thumbs up, so it can help others
    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

     

  • Verified answer
    Marshal_Jerome Profile Picture
    88 on at

    Hi,

    You can use Power function as in below example.

     

    Power (10, Len (TextInput1.Text) +1);

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard