fieds formatting issue

  • Thread starter Thread starter Drew
  • Start date Start date
D

Drew

All I want to do is format a merge field in a document template to display
only the last 4 digits of a social security number. Sound easy?

It appears that the default behavior of Word makes this extremely difficult,
when, in fact it, should be extremely simple...or maybe I'm just an idiot.

Is there a way to write a field switch to make this happen?

"\# x####" and variations thereof give me a sum.

Thanks.

A
 
OK, I see why it doesn't work like it should and sort of have a solution,
unfortunately, my solution doesn't work.

{Quote
{SET ID {MERGEFILED SSN}}
{SET EXP1{=-{=-{ID}-ID}/2}}
{SET EXP2{=-({ID}*(-1)-{ID})/2}}
{SET EXP3{=-({EXP1}+{EXP2}-{ID})}}"XXX-XX-"{EXP3 \# 0000}}

....works fine, except in the doc that I need it to work. There, it gives me
a syntax error. What am I doing wrong?
 
I haven't actually tested the code, but I do notice that the example you
posted spells "MERGEFILED" instead of "MERGEFIELD." Could that be the error?
 
Hi Drew,

If your source data is '###-##-####' and is not simply '#########' formatted to look like '###-##-####', try:
{QUOTE
{SET ID {MERGEFIELD SSN}}
{SET EXP{=({ID}*(-1)-ID)/2}}"XXX-XX-"{EXP \# 0000}}

If your source data is '#########' formatted to look like '###-##-####', try:
{=MOD({MERGEFIELD SSN},10000) \# "XXX-XX-0000"}
 
For the second solution, try:
"XXX-XX-{=MOD({MERGEFIELD SSN}, 10000) \# 0000}"

--
Cheers
macropod
[MVP - Microsoft Word]


macropod said:
Hi Drew,

If your source data is '###-##-####' and is not simply '#########' formatted to look like '###-##-####', try:
{QUOTE
{SET ID {MERGEFIELD SSN}}
{SET EXP{=({ID}*(-1)-ID)/2}}"XXX-XX-"{EXP \# 0000}}

If your source data is '#########' formatted to look like '###-##-####', try:
{=MOD({MERGEFIELD SSN},10000) \# "XXX-XX-0000"}

--
Cheers
macropod
[MVP - Microsoft Word]


Drew said:
OK, I see why it doesn't work like it should and sort of have a solution,
unfortunately, my solution doesn't work.

{Quote
{SET ID {MERGEFILED SSN}}
{SET EXP1{=-{=-{ID}-ID}/2}}
{SET EXP2{=-({ID}*(-1)-{ID})/2}}
{SET EXP3{=-({EXP1}+{EXP2}-{ID})}}"XXX-XX-"{EXP3 \# 0000}}

...works fine, except in the doc that I need it to work. There, it gives me
a syntax error. What am I doing wrong?
 
Yay! It works. Thanks a lot!

However...
Same document, similar situation, except that the data I'm merging is both a
name and an SSN. Can I do the same thing with that? I can get the name by
itself from another data source, but not the SSN. Can I format the field to
ignore the name entirely and just format the number?

macropod said:
For the second solution, try:
"XXX-XX-{=MOD({MERGEFIELD SSN}, 10000) \# 0000}"

--
Cheers
macropod
[MVP - Microsoft Word]


macropod said:
Hi Drew,

If your source data is '###-##-####' and is not simply '#########' formatted to look like '###-##-####', try:
{QUOTE
{SET ID {MERGEFIELD SSN}}
{SET EXP{=({ID}*(-1)-ID)/2}}"XXX-XX-"{EXP \# 0000}}

If your source data is '#########' formatted to look like '###-##-####', try:
{=MOD({MERGEFIELD SSN},10000) \# "XXX-XX-0000"}

--
Cheers
macropod
[MVP - Microsoft Word]


Drew said:
OK, I see why it doesn't work like it should and sort of have a solution,
unfortunately, my solution doesn't work.

{Quote
{SET ID {MERGEFILED SSN}}
{SET EXP1{=-{=-{ID}-ID}/2}}
{SET EXP2{=-({ID}*(-1)-{ID})/2}}
{SET EXP3{=-({EXP1}+{EXP2}-{ID})}}"XXX-XX-"{EXP3 \# 0000}}

...works fine, except in the doc that I need it to work. There, it gives me
a syntax error. What am I doing wrong?


:

All I want to do is format a merge field in a document template to display
only the last 4 digits of a social security number. Sound easy?

It appears that the default behavior of Word makes this extremely difficult,
when, in fact it, should be extremely simple...or maybe I'm just an idiot.

Is there a way to write a field switch to make this happen?

"\# x####" and variations thereof give me a sum.

Thanks.

A
 
Hello,
You suggested something I would like to try....stupid question, how do you
get this in ...is quote a quote or spelled out word, do you type in set id
etc?

Thanks for any additional guidance you can provide.

joyce

macropod said:
Hi Drew,

If your source data is '###-##-####' and is not simply '#########' formatted to look like '###-##-####', try:
{QUOTE
{SET ID {MERGEFIELD SSN}}
{SET EXP{=({ID}*(-1)-ID)/2}}"XXX-XX-"{EXP \# 0000}}

If your source data is '#########' formatted to look like '###-##-####', try:
{=MOD({MERGEFIELD SSN},10000) \# "XXX-XX-0000"}

--
Cheers
macropod
[MVP - Microsoft Word]


Drew said:
OK, I see why it doesn't work like it should and sort of have a solution,
unfortunately, my solution doesn't work.

{Quote
{SET ID {MERGEFILED SSN}}
{SET EXP1{=-{=-{ID}-ID}/2}}
{SET EXP2{=-({ID}*(-1)-{ID})/2}}
{SET EXP3{=-({EXP1}+{EXP2}-{ID})}}"XXX-XX-"{EXP3 \# 0000}}

...works fine, except in the doc that I need it to work. There, it gives me
a syntax error. What am I doing wrong?
 
Press CTRL+F9 for the curly bracket pairs and type the rest.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Joyce said:
Hello,
You suggested something I would like to try....stupid question, how
do you get this in ...is quote a quote or spelled out word, do you
type in set id etc?

Thanks for any additional guidance you can provide.

joyce

macropod said:
Hi Drew,

If your source data is '###-##-####' and is not simply '#########'
formatted to look like '###-##-####', try: {QUOTE
{SET ID {MERGEFIELD SSN}}
{SET EXP{=({ID}*(-1)-ID)/2}}"XXX-XX-"{EXP \# 0000}}

If your source data is '#########' formatted to look like
'###-##-####', try: {=MOD({MERGEFIELD SSN},10000) \# "XXX-XX-0000"}

--
Cheers
macropod
[MVP - Microsoft Word]


Drew said:
OK, I see why it doesn't work like it should and sort of have a
solution, unfortunately, my solution doesn't work.

{Quote
{SET ID {MERGEFILED SSN}}
{SET EXP1{=-{=-{ID}-ID}/2}}
{SET EXP2{=-({ID}*(-1)-{ID})/2}}
{SET EXP3{=-({EXP1}+{EXP2}-{ID})}}"XXX-XX-"{EXP3 \# 0000}}

...works fine, except in the doc that I need it to work. There, it
gives me a syntax error. What am I doing wrong?


:

All I want to do is format a merge field in a document template to
display only the last 4 digits of a social security number. Sound
easy?

It appears that the default behavior of Word makes this extremely
difficult, when, in fact it, should be extremely simple...or maybe
I'm just an idiot.

Is there a way to write a field switch to make this happen?

"\# x####" and variations thereof give me a sum.

Thanks.

A
 
Back
Top