Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    May 2009
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Using Word 2002:

    A system field (can't edit) always returns DIV + a number between 1 and 40. For example, DIV19. I only need the number to merge into a form field and not the DIV. Is it possible to add switches to suppress the "DIV" and show only the number after the merge?

    My crude attempt at an IF field below. If DIV is present in merge data for Title field, do not show the DIV but show the number.

    { IF { MERGEFIELD Title } = "DIV" "" "" }

    Hopefully, you can see through my inexperience with this field formatting and can post an answer to my question.

    Many thanks,
    Charlie
    charlie6067

  2. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Hi Charlie,

    You can do this with a field coded as:
    {QUOTE{SET MyData {MERGEFIELD MyField}}
    {IF{REF MyData }= "*1?" 1 {IF{REF MyData }= "*2?" 2 {IF{REF MyData }= "*3?" 3 {IF{REF MyData }= "*4?" 4 {IF{REF MyData }= "*5?" 5 {IF{REF MyData }= "*6?" 6 {IF{REF MyData }= "*7?" 7 {IF{REF MyData }= "*8?" 8 {IF{REF MyData }= "*9?" 9 0}}}}}}}}}
    {IF{REF MyData }= "*1" 1 {IF{REF MyData }= "*2" 2 {IF{REF MyData }= "*3" 3 {IF{REF MyData }= "*4" 4 {IF{REF MyData }= "*5" 5 {IF{REF MyData }= "*6" 6 {IF{REF MyData }= "*7" 7 {IF{REF MyData }= "*8" 8 {IF{REF MyData }= "*9" 9 0}}}}}}}}}}
    where 'MyField' is the name of your mergefield.

    This looks daunting, but it's really quite simple. The bulk of the field coding consists of two pairs of 9 nested IF fields coded as {IF{REF Data}= "*#?" # !}, where the:
    • field braces (i.e. '{ }') are created in pairs via Ctrl-F9;
    • '*' is a wildcard substitution for all characters in the field preceding the one you're looking for;
    • '#' is the number you're looking for;
    • '?' is a wildcard substitution for the succeeding character in the field; and
    • '!' represents the next number or nested IF test.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  3. #3
    Star Lounger
    Join Date
    May 2009
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you Paul. That was a lot of work for you write out but I appreciate it and will try it out tomorrow at the office. Happy New Years. Charlie charlie6067

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •