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
Hi,
You can use Power function as in below example.
Power (10, Len (TextInput1.Text) +1);
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),"")
Now as I type
Now I type 5 characters
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
WarrenBelz
637
Most Valuable Professional
stampcoin
570
Super User 2025 Season 2
Power Apps 1919
473