Hi macropod
Sorry, my mistake. I was so intimidated by your solution.
"zz" only indicates there is more than 1 filed in the record.
Header is: "Number","Name"
--
Best regards
Joergen Bondesen
Hi Joergen,
Is the "zz" part of the same field in your text file as the 20 digits
"09812340078901230067" (eg: "09812340078901230067zz"), or are they
separate
fields (eg: "09812340078901230067" & "zz")?
Is the "zz" part of the barcode? If so, is it always "zz", or can other
letters be involved?
Cheers
--
macropod
[MVP - Microsoft Word]
Hi Doug Robbins; Peter Jamieson; Graham Mayor and macropod
Thanks to all of you for all the answers.
I have a mailmerge field where the field from a txt-file
display 20 digits: "09812340078901230067","zz" and the next number is
"09812340078901230068","zz" etc.
Of course I can remove the 0 (zero) from the txt-file but it is daily,
takes
time and I can forget it.
I am using the number on a carrier (letter with a card) with a font 3of9
so
i can have a barcode.
Ouer mailermachine read the barcode and compare the number with the
number
on the card.
Cardnumber is 19 digits: 9812340078901230067 because the card is
without
0
(zero).
I hope this explains my dilemma.
I will bee back with thanks or further ask for help.
Best regards
Joergen Bondesen
Hi Joergen,
If you *really* can't change the source file, you could code your
mailmerge
template like:
{SET Data {MERGEFIELD Value}}{=INT(Data/10^5)}{IF{REF Data}=
"*1????" 1
{IF{REF Data}= "*2????" 2 {IF{REF Data}= "*3????" 3 {IF{REF Data}=
"*4????"
4 {IF{REF Data}= "*5????" 5 {IF{REF Data}= "*6????" 6 {IF{REF Data}=
"*7????" 7 {IF{REF Data}= "*8????" 8 {IF{REF Data}= "*9????" 9
0}}}}}}}}}{IF{REF Data}= "*1???" 1 {IF{REF Data}= "*2???" 2 {IF{REF
Data}=
"*3???" 3 {IF{REF Data}= "*4???" 4 {IF{REF Data}= "*5???" 5 {IF{REF
Data}=
"*6???" 6 {IF{REF Data}= "*7???" 7 {IF{REF Data}= "*8???" 8 {IF{REF
Data}=
"*9???" 9 0}}}}}}}}}{IF{REF Data}= "*1??" 1 {IF{REF Data}= "*2??" 2
{IF{REF
Data}= "*3??" 3 {IF{REF Data}= "*4??" 4 {IF{REF Data}= "*5??" 5 {IF{REF
Data}= "*6??" 6 {IF{REF Data}= "*7??" 7 {IF{REF Data}= "*8??" 8 {IF{REF
Data}= "*9??" 9 0}}}}}}}}}{IF{REF Data}= "*1?" 1 {IF{REF Data}=
"*2?" 2
{IF{REF Data}= "*3?" 3 {IF{REF Data}= "*4?" 4 {IF{REF Data}= "*5?" 5
{IF{REF
Data}= "*6?" 6 {IF{REF Data}= "*7?" 7 {IF{REF Data}= "*8?" 8 {IF{REF
Data}=
"*9?" 9 0}}}}}}}}}{IF{REF Data}= "*1" 1 {IF{REF Data}= "*2" 2
{IF{REF
Data}=
"*3" 3 {IF{REF Data}= "*4" 4 {IF{REF Data}= "*5" 5 {IF{REF Data}= "*6"
6
{IF{REF Data}= "*7" 7 {IF{REF Data}= "*8" 8 {IF{REF Data}= "*9" 9
0}}}}}}}}}
Looks rather intimidating, doesn't it!
Here's the same coding broken down into its component parts, and an
explanation of how things work:
{SET Data {MERGEFIELD Value}}
This simply uses a SET field to create a bookmarked copy of your
mailmerge
value. Substitute the real name for 'Value'.
{=INT(Data/10^5)}
This reduces the field length to the 15-digit maximum that Word can
handle,
stripping off any leading 0s, and displays whatever's left.
{IF{REF Data}= "*1????" 1 {IF{REF Data}= "*2????" 2 {IF{REF Data}=
"*3????"
3 {IF{REF Data}= "*4????" 4 {IF{REF Data}= "*5????" 5 {IF{REF Data}=
"*6????" 6 {IF{REF Data}= "*7????" 7 {IF{REF Data}= "*8????" 8 {IF{REF
Data}= "*9????" 9 0}}}}}}}}}
This set of 9 nested IF fields tests the 5th-last digit in the field
and
displays whatever number it is.
{IF{REF Data}= "*1???" 1 {IF{REF Data}= "*2???" 2 {IF{REF Data}=
"*3???"
3
{IF{REF Data}= "*4???" 4 {IF{REF Data}= "*5???" 5 {IF{REF Data}=
"*6???"
6
{IF{REF Data}= "*7???" 7 {IF{REF Data}= "*8???" 8 {IF{REF Data}=
"*9???"
9
0}}}}}}}}}
This set of 9 nested IF fields tests the 4th-last digit in the field
and
displays whatever number it is.
{IF{REF Data}= "*1??" 1 {IF{REF Data}= "*2??" 2 {IF{REF Data}=
"*3??" 3
{IF{REF Data}= "*4??" 4 {IF{REF Data}= "*5??" 5 {IF{REF Data}=
"*6??" 6
{IF{REF Data}= "*7??" 7 {IF{REF Data}= "*8??" 8 {IF{REF Data}=
"*9??" 9
0}}}}}}}}}
This set of 9 nested IF fields tests the 3rd-last digit in the field
and
displays whatever number it is.
{IF{REF Data}= "*1?" 1 {IF{REF Data}= "*2?" 2 {IF{REF Data}= "*3?" 3
{IF{REF
Data}= "*4?" 4 {IF{REF Data}= "*5?" 5 {IF{REF Data}= "*6?" 6 {IF{REF
Data}=
"*7?" 7 {IF{REF Data}= "*8?" 8 {IF{REF Data}= "*9?" 9 0}}}}}}}}}
This set of 9 nested IF fields tests the 2nd-last digit in the field
and
displays whatever number it is.
{IF{REF Data}= "*1" 1 {IF{REF Data}= "*2" 2 {IF{REF Data}= "*3" 3
{IF{REF
Data}= "*4" 4 {IF{REF Data}= "*5" 5 {IF{REF Data}= "*6" 6 {IF{REF
Data}=
"*7" 7 {IF{REF Data}= "*8" 8 {IF{REF Data}= "*9" 9 0}}}}}}}}}
This set of 9 nested IF fields tests the last digit in the field and
displays whatever number it is.
Each set of 9 nested IF fields is basically a compilation 9 sets of:
{IF{REF Data}= "*#?" # !},
where the:
. field braces (i.e. '{ }') are created in paird via Ctrl-F9;
. '*' is a wildcard representing all numbers in the field