Keeping a leading zero for different number lengths

Copper Contributor

Hi there

 

I am generating a sharepoint contact for power apps.

 

I have 3 fields

1. Name

2. phone - stored as a number.

- this may be anywhere between 8 to 10 digits, depending on whether it's a mobile or fixed line

- the 10 digit numbers have a leading 0, the 8 digit numbers don't

 

3. a validation field with the formula =Text(phone, "0")

This converts it to a text number that PowerApps can "interpret" as a phone number to click and dial out.

However this formula causes the leading zero on the mobile phones to be removed. if i increase the number of zeros (e.g: 000 000 0000), the leading zero on the mobile phone number is preserved, but a 00 is added to the 8 digit numbers (so they don't work as a phone number)

 

Is there a way for the =Text(phone,"0") formula to just preserve the 0 for the 10 digit number, but not add extra 0 to the 8 digit number?

 

Sing 

0 Replies