Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Joing 2 Numbers

Status
Not open for further replies.

flashes24

IS-IT--Management
Oct 26, 2004
31
US
I have made formula's to seperate numbers into 2 parts (@PHONE1 and @PHONE2) for the last 7 digits of a phone number. Now I need to join them back together with the standard '-' for display. Does anyone know the formula to joing these two numbers?

EX:
Have: PHONE1 = 555 PHONE2 + 7777

Want: 555-7777
 
If these are of number datatype, then try:

totext({@Phone1},0,"")+"-"+totext({@Phone2},0,"")

-LB
 
That worked perfectly, but I have one phone number that is 0755 and the first 0 does not display. I have tried the right click and formatting, but still no leading 0. Any suggestions.
 
Change the formula to:

totext({@Phone1},"000")+"-"+totext({@Phone2},"0000")

-LB
 
No, it didn't work.

I did it both of these ways:
totext({@Phone1},"000")+"-"+totext({@Phone2},"0000")
and
totext({@Phone1},"000", "")+"-"+totext({@Phone2},"0000", "")

If I don't put the null space at the adds the thousands seperator. Do you think it could be in my seperating formula? Here is the formula for the second half of numbers.

ToNumber (Mid (ToText ({CUST_PHN}), 5, 5))

I had to put 5 for the number of spaces because of the thousands seperator.
 
Try changing your {@phone2} formula to:

ToNumber(Mid(ToText({CUST_PHN},0,""), 5, 4))

Do you want to try to explain why you broke the field into two pieces to begin with? You could maybe have used the picture function to begin with, as in:

picture(totext({table.cust_phn},0,""),"xxx-xxxx")

-LB
 
I divided the field trying to put in the "-" for easy viewing. I didn't know I didn't have to do that for changing the display.

My name of my field id {CUST_PHN} and it is stored as 5,557,777.00

How can I formulat this to be seen as 555-7777?

P.S. I really do appreciate the time you are helping me out with this.
 
Did you try the picture function as I demonstrated in my last post? That should work.

-LB
 
That worked beautifully.

Thanks a lot lbass you have taught me something I didn't know. What other type of fields does the picture command work?
 
I use it for social security numbers. You might want to look up "Picture function" in the help files. It's basically for formatting strings to display in a consistent way.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top