Jump to content

Business card set-up? 3 phone numbers


dkent

Recommended Posts

Business card set-up? 3 phone numbers

 

I have a business card where I need have Variable data

using three phone number

 

sample of want I'm trying to get-

1 (p) 000-000-0000 (f) 000-000-0000 © 000-000-0000

2 (p) 000-000-0000 (f) 000-000-0000

3 (p) 000-000-0000 © 000-000-0000

4 (p) 000-000-0000

 

Each staff member uses different phone numbers on there business card

some will use (p) (F) and (p) © and (p) (f) © and any combo of the three

 

But they only want the phone that are on the data to show

But I keep getting this ( see sample A and B)

A---(p) 000-000-0000 (f) © 000-000-0000

B---(p) 000-000-0000 (f) 000-000-0000 ©

C-- (p) 000-000-0000 (f) ©

 

as you see in A--- there is no phone number in (f) but I still got a blank spot there and in B-- I still get the © the then blank

and in C-- both (f) and © have blank spots

 

 

Any help on this would be great

D

Link to comment
Share on other sites

It's a specific to JavaScript 1.6. FP8 uses JavaScript 1.7 and earlier releases use 1.5.

 

I guess if dkent is using FP7, this solution might work better for him:

var result = "";
result += (Field("phone") != "" ) ? "(p) " + Field("phone") : "";
result += (Field("cell") != "" ) ? "(c) " + Field("cell") : "";
result += (Field("fax") != "" ) ? "(f) " + Field("fax") : "";
return result;

 

Or:

var phone = "(p) " + Field("phone");
var cell = "(c) " + Field("cell");
var fax = "(f) " + Field("fax");
return (phone + cell + fax).replace(/\(\D\)\s(?!\d)/g,"");

Link to comment
Share on other sites

It's a specific to JavaScript 1.6. FP8 uses JavaScript 1.7 and earlier releases use 1.5.

Yes, I remember hearing this somewhere. ;)

 

If you're using an earlier version of FusionPro, you can patch the Array.filter function in by copying the code from this page and pasting it into your JavaScript Globals:

https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter#Compatibility

Link to comment
Share on other sites

  • 1 month later...

Ok

they change it up on me here

the old code is working great I got

but now they to see a proof with this now

 

sample of want I'm trying to get-

1 (p) 000-000-0000 l (f) 000-000-0000 l © 000-000-0000

2 (p) 000-000-0000 l (f) 000-000-0000

3 (p) 000-000-0000 l © 000-000-0000

4 (p) 000-000-0000

5 (f) 000-000-0000 l © 000-000-0000

6 © 000-000-0000

 

 

But I keep getting this ( see sample A and B)

A--- l (f) 000-000-0000 l © 000-000-0000

B--- l © 000-000-0000

 

The problem I now running into is the line in the front look at B and A

For B only the cell is want but they do not want the line in front of it

Edited by dkent
Link to comment
Share on other sites

this is the code that is working the best

 

var result = "";

result += (Field("phone") != "" ) ? "(P)" + Field("phone") : "";

result += (Field("cell") != "" ) ? " I ©" + Field("cell") : "";

result += (Field("fax") != "" ) ? " I (F)" + Field("fax") : "";

return result;

Link to comment
Share on other sites

works great thanks

 

one more question

do you know a rule to -if this field is blank move line up

 

like this

field department - the rock

 

Dave Dent -- name field

Couch-- title field

The Rock-- here is the department field that some people will need and others will not

dave.dent@ - if the they leave the department field blank I need to move this up

Link to comment
Share on other sites

new question

on this code what is the best way made add a Style lock to the phone part so will only show up x3312 no extension, no ext if they have a extension

 

var numbers = ["(p) " + Field("phone"),"© " + Field("cell"),"(f) " + Field("fax")];

return numbers.filter(function(s){return s.length>4;}).join(" | ");

Link to comment
Share on other sites

I'm not entirely sure what you're trying to accomplish. Your first post says you want to drop the extension if it's present in the data. Your example shows an extension.

 

Under the assumption you want to drop the extension:

 

var numbers = ["(p) " + Field("phone"),"(c) " + Field("cell"),"(f) " + Field("fax")];
return numbers.filter(function(s){return s.length>4;}).join(" | ").replace(/\s?[ext](\w*)?\s?\d+/gi,"");

Link to comment
Share on other sites

OK let me try and clear what I need help on

I found to need to use dashes for all phone numbers

 

we want this

(p) 703-557-0000 x3344

(p) 706-990-9000

 

not this

(p) 703.577.3000

 

on all phone - cell - fax number - we must now use dashes not dots

can we add a global find and replace to this code

var numbers = ["(P) " + Field("phone"),"© " + Field("cell"),"(F) " + Field("fax")];

return numbers.filter(function(s){return s.length>4;}).join(" | ");

 

to find . and replace with -

in the phone cell and fax fields

 

 

d

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...