cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Powerapps Form - retain leading zeros

Hi,

 

Can someone please help.

 

I have created a form in Powerapps which once submitted, a new item is created in a Sharepoint list. Two of the fields within the form requires the user to input bank sort code and account number. In some cases, the sort code and account number will begin with zeros but when the item is created in the Sharepoint list, it does not bring over any leading zeros. I know its not an issue with Sharepoint as when an item is created directly on Sharepoint, the fields show the leading zeros. I have tried changing the format from number to text in Powerapps but doesn't resolve the issue.

 

Many Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

1) I removed column "Sort number" (just Number in my case) from the form

2) added new column in SPO

3) refreshed source

 

and now is field Number changed to text in PA as well.

 

image.png

 

So observation is:

When nothing except the type of your column changes in SPO, source refresh does not work (type of the field is somehow changed, but not in the way you would expect ... it still behaves as number.

 

Same is it when you keep the fields on the form it changes the field in certain way, but again not in the correct way.

 

BUT when you

 

1) Remove changed fields from the form

2) add new column to the list

3) perform refresh of the source

 

then the datatype is changed in the form fields as well and now when you add back to the form it it will do the exactly what you want.

 

 

View solution in original post

35 REPLIES 35
mdevaney
Super User III
Super User III

Please try the text function

Example for 5 decimal places:
Text(your_fieldname,”00000”)
Anonymous
Not applicable

Hi,

 

I tried this but doesn't seem to work. Just to make sure I am inserting this in the correct field, can you please clarify where I should be inserting this formula? is it in the Design - Format field within the Powerapps properties?

 

Many Thanks

You’d want to use code like this in the Default property of the card

Text(ThisItem.your_fieldname,”00000”)
Anonymous
Not applicable

Thanks but this doesn't seem to work either.

@Anonymous 

Can you please take a screenshot showing your full workspace.  Make sure I can see the Card name and show the Default property in the screenshot.

 

Also, what is the data type of the column in SharePoint for account number?

Anonymous
Not applicable

Here is a screenshot. The Sharepoint column is set to single line of text.

 

Capture.JPG

 

 

@Anonymous 

I see the issue thanks to your screenshot.

 

Please retype the double quotes in your formula they are the problem.  Sometimes you cannot copy + paste functions with double quotes from the web browser because they will not appear properly in PowerApps.

Anonymous
Not applicable

Thanks, however, this hasn't solved the problem, the leading zeros are still not present in my sharepoint list. 

 

Any other suggestions?

 

Many Thanks

@Anonymous 

Well, if you want to have leading zeros showing in your actual SharePoint list then you'll just have to change your SharePoint column to single-line text.  You can't submit a number to SharePoint via PowerApps having leading zeros.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (64,154)