Jump to content

Business card set-up? 3 phone numbers


dkent

Recommended Posts

Posted

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

Posted

Try this:

var numbers = ["(p) " + Field("phone"),"(c) " + Field("cell"),"(f) " + Field("fax")];
return numbers.filter(function(s){return s.length>4;}).join(" ");

Posted

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,"");

  • 1 month later...
Posted

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

Posted

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;

Posted

Use this code instead:

var numbers = ["(p) " + Field("phone"),"(c) " + Field("cell"),"(f) " + Field("fax")];
return numbers.filter(function(s){return s.length>4;}).join(" | ");

Posted

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

Posted

You could just repurpose the code I just posted, like this:

 

var contact = [Field("name"),Field("title"),Field("department"),Field("email")];
return contact.filter(String).join("<br>");

Posted

yes Well

I have some rules for the name and tile to lock the style -

and it like I will lose those

can I just make a rule for the department only

Posted

You did not specify what your current rule was.

Why don't you just set the text frame to "suppress if empty"?

Posted

thanks that work

wish I remember that was there before I asked

 

but thanks for all the help

Posted

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(" | ");

Posted

samply of what i'm trying to get

 

Dave Dent

Print Shop

David.dent@---

(P) 703-770-6676 x3313 l © 809-990-4000

Posted

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,"");

Posted

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...