cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
juresti
Continued Contributor
Continued Contributor

format fixed length number

 

I was using the Text(number,000) for formatting data except I found that it is for display purpose.

It won't save your data with that format.

 

Instead I started using Right(Concatenate("0000",number),6) since I need 6 digits.

 

This is going directly into a Patch column on a CDS database.

 

02.PNG

03.PNG

 

No leading zeros saved, unless I use Right(Concatenate("0000",....... This one works correctly.

 

Am I understanding this correctly? The Text is only for display purposes and not for appending leading zeros while saving the data.

 

5 REPLIES 5
WarrenBelz
Super User
Super User

Hello @juresti ,

I will get one question out of the way first.

Is your destination field a text or number field?

 

juresti
Continued Contributor
Continued Contributor

 

It is a text field.

 

I think I'm understanding it correctly because excel also has a similar format formula, but it's just for display and shows leading zeros, then when you click the cell, it does not have zeros.

 

It must be the same thing.

 

 

OK thanks @juresti ,

I am not on my PC so cannot test this, but maybe

Right(Concatenate("0000",Text(number,"######"),6)

or something along that line may be worth a try.

Another thought - a type conversion to a number and then back to Text.

Text(Value(txtObserverEID_1.Text),"000000")

may get the bit you concatenate onto.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

v-xida-msft
Community Support
Community Support

Hi @juresti ,

Actually, it is an known issue within Excel table -- When patching Number formatted Text value (using Text function) back to Text column or Number column, the 0 (zero) before the positive number (1,2,3,...) within the value would be recognized as a invalid value, and would be removed from the saved value automatically.

 

As an alternative solution, I agree with your though almost. The combination of Concatenate function and Right function could achieve your needs.

You could also consider take a try with the following formula:

Patch(Table1, Defaults(Table1),{TextColumn: Left("000000",6-Len(TextInput1.Text)) & TextInput1.Text })

 

In addition, you could consider add a SP List as your data source instead of the Excel table. The Text() function would work in Single Text type column in SP List without above issue you mentioned.

 

Best regards, 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,179)