Phone formatting

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Phone formatting

Postby alasdairs » Thu Mar 28, 2024 3:16 pm

Hi all,

I was wondering how I could get a number in a text field from the database to be formatted as the full string. I have some phone numbers in the database at the moment but they are all being shown as #.#########E9. I need them to just be the string sent from the database just in case a number has a bracket, plus, space, or 0 at the beginning.

Thanks,
Alasdair
Software Engineer
alasdairs
 
Posts: 45
Joined: Wed Dec 27, 2023 10:06 pm
Location: The Internet

Re: Phone formatting

Postby mboegem » Thu Mar 28, 2024 4:49 pm

Seems to me that the field is currently a number/integer, which means it can not have a bracket/plus/space in the database.

In order to display numbers as text you can create a calculation in Servoy and use:
Code: Select all
utils.numberFormat(myField, '#')


You can then format the string with whatever rule you like.
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1752
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Phone formatting

Postby alasdairs » Thu Mar 28, 2024 6:41 pm

Thanks marc, that works perfectly!
Software Engineer
alasdairs
 
Posts: 45
Joined: Wed Dec 27, 2023 10:06 pm
Location: The Internet


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 38 guests

cron