Jump to content

Swap fields in same position


aldipalo

This topic is 6585 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Ok, somewhere along my development line I read that if you have multiple telephone numbers for your contacts (these days don't we all?)you should set up a separate table for Telephone Numbers. I also incorporated a Telephone Format custom function as well. Problem is custom function format doesn't accomodate international numbers. So, I set up a separate field for International numbers. My regular numbers are in a portal.

Here's what I would like to do:

Find a new custom Function that accomodates Intl as well as domestic numbers. That would be the easy way to resolve the issue for me.

OR....

On some of my reports and layouts I want to just show the direct contact number. So, I thought I could place the Direct Line on top of the Intl Number and have only the field that is filled show.

And....

On my main layout "Contacts" I would like to have the Intl number show only if it is "Not Empty." I doubt that I can hide the telephone number portal so I'd just like it to be visible if there is a number in it.

Can anyone point me in the right direction, Please........

Thanks,

Al

Link to comment
Share on other sites

I'd stick with the portal and work on modifying your CF to accomodate international numbers. You might search the forums to see if a comprehensive CF exists that does this already. If you can't find build one, you could do a work-around that leaves the formatting alone if the number has an international prefix.

Link to comment
Share on other sites

Hi Ender:

Thanks for the advice it wasn't as difficult as I thought it would be. Here's the finished CF. Now, if I enter an International number it formats it for me. One of the problems with Intl numbers is that they are all not the same length. In some countries they are similar to ours - 3 digit area code - 3 digit exchange - 4 digit number. So, if you have Intl code = 011 and Country code = 49 and AC = 123 and exchange = 456 and number 7890 the CF will format it 011-49-123-456-7890.

On the other hand if the number is 011320256565 the cf will format it 011-32-025-656-5. I supposed we could try to figure out the minimum and maximum number of numbers on all countires, but, I don't think it matters since the formatting is only to make dialing easier. Any comments, suggestions,corrections would be appreciated.

*************************************************

Case(

Length(Phone Number) = 7;Left(Phone Number;3) & "-" & Right(Phone Number;4);

(Length(Phone Number) = 10); "(" & Left(Phone Number;3) & ") " & Middle(Phone Number; 4; 3) & "-" & Right(Phone Number;4);

(Length(Phone Number) >10) and Left (Phone Number ;3)="011";Left(Phone Number;3) & "-" & Middle(Phone Number; 4; 2) & "-" & Middle(Phone Number; 6; 3)& "-" & Middle(Phone Number; 9; 3) & "-" & Right(Phone Number;4);

"Wrong number format")

*************************************************

Al

Link to comment
Share on other sites

You should probably account for those pesky users that may try entering the phone number formatting themselves. This can be done by using the Filter() function to strip away everything but the digits, like:

Filter ( Phone Number ; "0123456789" )

then process it from there.

But what about extensions? You may also want to allow for an x, and leave the formatting for the extension part of the number. Also, since there could be cases where international numbers are entered and you don't know the exact length of those, or someone could type something wrong, it may be better to leave the phone numbers for those unrecognized formats alone (or maybe change its color) rather than replace it with "Wrong number format."

Anyway, if you look around for a good custom function, most of this stuff should be in there.

Link to comment
Share on other sites

This topic is 6585 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.