Nest If Statements in REF Field

S

singeredel

I am trying to set up multiple conditions for filling in a REF Field but am
having trouble getting them all to work.

I have two bookmarks: ReferringPhysician and AttentionLine.

Depending on which bookmarks have information in them, I want to reference
that particular information in the REF fields for the bookmarks. There are
three choices:

1. If AttentionLine has information in the bookmark, I want to use that
variable in the REF field.

2. If AttentionLine is blank and ReferringPhysician is not blank, I want to
use the ReferringPhysician variable in the REF field.

3. If both AttentionLine and ReferringPhysician are blank, I want the REF
field to be blank so that it does not generate an Error! message.

This is the code I came up with for the IF statement, but obviously there is
something wrong with the nesting:

{ IF { REF AttentionLine } <>"" {REF AttentionLine } { IF { REF
AttentionLine } = "" AND { REF ReferringPhysician } <>"" { REF
ReferringPhysician } "" } }

Basically, this is how I want it to look:

Attention: (variable AttentionLine)
Referring Physician: (variable ReferringPhysician)

Dear {REF AttentionLine} or {REF ReferringPhysician} or blank

The "Dear REF" is what I am trying to address here.

Hope this is clear and someone can help.

Thank you!
 
M

macropod

Hi singeredel,

Try:
{IF{REF AttentionLine}= "" {IF{REF ReferringPhysician}= "" "" {REF ReferringPhysician}} {REF AttentionLine}}

Cheers
 
S

singeredel

Thank you for your help! This appears to work for choices 1 and 3 above, but
does not work for choice 2 and leaves the REF area blank. I am having trouble
following the nesting, as I am not a programmer, so I am unable to figure out
what might need to be changed in the offered code.

thanks...
--
singeredel


macropod said:
Hi singeredel,

Try:
{IF{REF AttentionLine}= "" {IF{REF ReferringPhysician}= "" "" {REF ReferringPhysician}} {REF AttentionLine}}

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

singeredel said:
I am trying to set up multiple conditions for filling in a REF Field but am
having trouble getting them all to work.

I have two bookmarks: ReferringPhysician and AttentionLine.

Depending on which bookmarks have information in them, I want to reference
that particular information in the REF fields for the bookmarks. There are
three choices:

1. If AttentionLine has information in the bookmark, I want to use that
variable in the REF field.

2. If AttentionLine is blank and ReferringPhysician is not blank, I want to
use the ReferringPhysician variable in the REF field.

3. If both AttentionLine and ReferringPhysician are blank, I want the REF
field to be blank so that it does not generate an Error! message.

This is the code I came up with for the IF statement, but obviously there is
something wrong with the nesting:

{ IF { REF AttentionLine } <>"" {REF AttentionLine } { IF { REF
AttentionLine } = "" AND { REF ReferringPhysician } <>"" { REF
ReferringPhysician } "" } }

Basically, this is how I want it to look:

Attention: (variable AttentionLine)
Referring Physician: (variable ReferringPhysician)

Dear {REF AttentionLine} or {REF ReferringPhysician} or blank

The "Dear REF" is what I am trying to address here.

Hope this is clear and someone can help.

Thank you!
 
D

Doug Robbins - Word MVP

Are you sure that the name of the physician is actually inside the bookmark
ReferringPhysician?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

singeredel said:
Thank you for your help! This appears to work for choices 1 and 3 above,
but
does not work for choice 2 and leaves the REF area blank. I am having
trouble
following the nesting, as I am not a programmer, so I am unable to figure
out
what might need to be changed in the offered code.

thanks...
--
singeredel


macropod said:
Hi singeredel,

Try:
{IF{REF AttentionLine}= "" {IF{REF ReferringPhysician}= "" "" {REF
ReferringPhysician}} {REF AttentionLine}}

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

singeredel said:
I am trying to set up multiple conditions for filling in a REF Field but
am
having trouble getting them all to work.

I have two bookmarks: ReferringPhysician and AttentionLine.

Depending on which bookmarks have information in them, I want to
reference
that particular information in the REF fields for the bookmarks. There
are
three choices:

1. If AttentionLine has information in the bookmark, I want to use
that
variable in the REF field.

2. If AttentionLine is blank and ReferringPhysician is not blank, I
want to
use the ReferringPhysician variable in the REF field.

3. If both AttentionLine and ReferringPhysician are blank, I want the
REF
field to be blank so that it does not generate an Error! message.

This is the code I came up with for the IF statement, but obviously
there is
something wrong with the nesting:

{ IF { REF AttentionLine } <>"" {REF AttentionLine } { IF { REF
AttentionLine } = "" AND { REF ReferringPhysician } <>"" { REF
ReferringPhysician } "" } }

Basically, this is how I want it to look:

Attention: (variable AttentionLine)
Referring Physician: (variable ReferringPhysician)

Dear {REF AttentionLine} or {REF ReferringPhysician} or blank

The "Dear REF" is what I am trying to address here.

Hope this is clear and someone can help.

Thank you!
 
M

macropod

Hi singeredel,

Make sure your field code spacing is exactly as posted - anything less *won't* work and, depending on where you insert any
extraneous spaces, anything more *may* fail also.

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

singeredel said:
Thank you for your help! This appears to work for choices 1 and 3 above, but
does not work for choice 2 and leaves the REF area blank. I am having trouble
following the nesting, as I am not a programmer, so I am unable to figure out
what might need to be changed in the offered code.

thanks...
--
singeredel


macropod said:
Hi singeredel,

Try:
{IF{REF AttentionLine}= "" {IF{REF ReferringPhysician}= "" "" {REF ReferringPhysician}} {REF AttentionLine}}

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

singeredel said:
I am trying to set up multiple conditions for filling in a REF Field but am
having trouble getting them all to work.

I have two bookmarks: ReferringPhysician and AttentionLine.

Depending on which bookmarks have information in them, I want to reference
that particular information in the REF fields for the bookmarks. There are
three choices:

1. If AttentionLine has information in the bookmark, I want to use that
variable in the REF field.

2. If AttentionLine is blank and ReferringPhysician is not blank, I want to
use the ReferringPhysician variable in the REF field.

3. If both AttentionLine and ReferringPhysician are blank, I want the REF
field to be blank so that it does not generate an Error! message.

This is the code I came up with for the IF statement, but obviously there is
something wrong with the nesting:

{ IF { REF AttentionLine } <>"" {REF AttentionLine } { IF { REF
AttentionLine } = "" AND { REF ReferringPhysician } <>"" { REF
ReferringPhysician } "" } }

Basically, this is how I want it to look:

Attention: (variable AttentionLine)
Referring Physician: (variable ReferringPhysician)

Dear {REF AttentionLine} or {REF ReferringPhysician} or blank

The "Dear REF" is what I am trying to address here.

Hope this is clear and someone can help.

Thank you!
 
S

singeredel

Yes, the bookmarks have data when applicable for checking the IF conditions.
--
singeredel


Doug Robbins - Word MVP said:
Are you sure that the name of the physician is actually inside the bookmark
ReferringPhysician?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

singeredel said:
Thank you for your help! This appears to work for choices 1 and 3 above,
but
does not work for choice 2 and leaves the REF area blank. I am having
trouble
following the nesting, as I am not a programmer, so I am unable to figure
out
what might need to be changed in the offered code.

thanks...
--
singeredel


macropod said:
Hi singeredel,

Try:
{IF{REF AttentionLine}= "" {IF{REF ReferringPhysician}= "" "" {REF
ReferringPhysician}} {REF AttentionLine}}

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

I am trying to set up multiple conditions for filling in a REF Field but
am
having trouble getting them all to work.

I have two bookmarks: ReferringPhysician and AttentionLine.

Depending on which bookmarks have information in them, I want to
reference
that particular information in the REF fields for the bookmarks. There
are
three choices:

1. If AttentionLine has information in the bookmark, I want to use
that
variable in the REF field.

2. If AttentionLine is blank and ReferringPhysician is not blank, I
want to
use the ReferringPhysician variable in the REF field.

3. If both AttentionLine and ReferringPhysician are blank, I want the
REF
field to be blank so that it does not generate an Error! message.

This is the code I came up with for the IF statement, but obviously
there is
something wrong with the nesting:

{ IF { REF AttentionLine } <>"" {REF AttentionLine } { IF { REF
AttentionLine } = "" AND { REF ReferringPhysician } <>"" { REF
ReferringPhysician } "" } }

Basically, this is how I want it to look:

Attention: (variable AttentionLine)
Referring Physician: (variable ReferringPhysician)

Dear {REF AttentionLine} or {REF ReferringPhysician} or blank

The "Dear REF" is what I am trying to address here.

Hope this is clear and someone can help.

Thank you!
 
S

singeredel

The field code spacing was tried exactly as you have listed, but the one
condition does not appear to work (the IF and AND statement does not work --
i.e. if AttentionLine is blank and ReferringPhysician is not blank, then use
ReferringPhysician).
--
singeredel


macropod said:
Hi singeredel,

Make sure your field code spacing is exactly as posted - anything less *won't* work and, depending on where you insert any
extraneous spaces, anything more *may* fail also.

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

singeredel said:
Thank you for your help! This appears to work for choices 1 and 3 above, but
does not work for choice 2 and leaves the REF area blank. I am having trouble
following the nesting, as I am not a programmer, so I am unable to figure out
what might need to be changed in the offered code.

thanks...
--
singeredel


macropod said:
Hi singeredel,

Try:
{IF{REF AttentionLine}= "" {IF{REF ReferringPhysician}= "" "" {REF ReferringPhysician}} {REF AttentionLine}}

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

I am trying to set up multiple conditions for filling in a REF Field but am
having trouble getting them all to work.

I have two bookmarks: ReferringPhysician and AttentionLine.

Depending on which bookmarks have information in them, I want to reference
that particular information in the REF fields for the bookmarks. There are
three choices:

1. If AttentionLine has information in the bookmark, I want to use that
variable in the REF field.

2. If AttentionLine is blank and ReferringPhysician is not blank, I want to
use the ReferringPhysician variable in the REF field.

3. If both AttentionLine and ReferringPhysician are blank, I want the REF
field to be blank so that it does not generate an Error! message.

This is the code I came up with for the IF statement, but obviously there is
something wrong with the nesting:

{ IF { REF AttentionLine } <>"" {REF AttentionLine } { IF { REF
AttentionLine } = "" AND { REF ReferringPhysician } <>"" { REF
ReferringPhysician } "" } }

Basically, this is how I want it to look:

Attention: (variable AttentionLine)
Referring Physician: (variable ReferringPhysician)

Dear {REF AttentionLine} or {REF ReferringPhysician} or blank

The "Dear REF" is what I am trying to address here.

Hope this is clear and someone can help.

Thank you!
 
D

Doug Robbins - Word MVP

What does just {REF ReferringPhysician}display?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

singeredel said:
Yes, the bookmarks have data when applicable for checking the IF
conditions.
--
singeredel


Doug Robbins - Word MVP said:
Are you sure that the name of the physician is actually inside the
bookmark
ReferringPhysician?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

singeredel said:
Thank you for your help! This appears to work for choices 1 and 3
above,
but
does not work for choice 2 and leaves the REF area blank. I am having
trouble
following the nesting, as I am not a programmer, so I am unable to
figure
out
what might need to be changed in the offered code.

thanks...
--
singeredel


:

Hi singeredel,

Try:
{IF{REF AttentionLine}= "" {IF{REF ReferringPhysician}= "" "" {REF
ReferringPhysician}} {REF AttentionLine}}

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

I am trying to set up multiple conditions for filling in a REF Field
but
am
having trouble getting them all to work.

I have two bookmarks: ReferringPhysician and AttentionLine.

Depending on which bookmarks have information in them, I want to
reference
that particular information in the REF fields for the bookmarks.
There
are
three choices:

1. If AttentionLine has information in the bookmark, I want to use
that
variable in the REF field.

2. If AttentionLine is blank and ReferringPhysician is not blank, I
want to
use the ReferringPhysician variable in the REF field.

3. If both AttentionLine and ReferringPhysician are blank, I want
the
REF
field to be blank so that it does not generate an Error! message.

This is the code I came up with for the IF statement, but obviously
there is
something wrong with the nesting:

{ IF { REF AttentionLine } <>"" {REF AttentionLine } { IF { REF
AttentionLine } = "" AND { REF ReferringPhysician } <>"" { REF
ReferringPhysician } "" } }

Basically, this is how I want it to look:

Attention: (variable AttentionLine)
Referring Physician: (variable ReferringPhysician)

Dear {REF AttentionLine} or {REF ReferringPhysician} or blank

The "Dear REF" is what I am trying to address here.

Hope this is clear and someone can help.

Thank you!
 
S

singeredel

I found my error. I left a space in the bookmark when testing so I wouldn't
lose the bookmark, so the space prevented the bookmark from being empty or
"".
 
S

singeredel

Hi again. I need to modify this further to include an IF condition for the
bookmark not being found. The prior nested code works fine until I have to
delete the area in the document where the bookmark turns out to be empty.
When I delete the bookmarked area, it then pops an Error! message that the
reference source is not found. For example, even if the Dear {REF
ReferringPhysician} puts in the name, when I delete the empty text for
AttentionLine that includes the bookmark, I then get an error showing.

i.e., I need it to do nothing and not pop and error if the referenced
bookmark does not exist, so that when I delete the empty line of text that
contains the bookmark, there is not an error.

Attention: (empty variable) -- this bookmark has no information and the
line eventually gets deleted because it is blank.

Referring Physician: Dr. A (variable) -- this bookmark has information
which shows in the REF next to "Dear "

Dear Dr. A: (this becomes an error once the AttentionLine bookmark gets
deleted.

Hope this is clear.

thanks!
 
M

macropod

Hi singeredel,

The following will suppress the error message in the absence of either or both bookmarks:
{IF{REF AttentionLine}= "Error*" "" {IF{REF AttentionLine}= "" {IF{REF ReferringPhysician}= "Error*" "" {IF{REF ReferringPhysician}=
"" "" {REF ReferringPhysician}}} {REF AttentionLine}}}

Cheers
 
S

singeredel

What is happening with this suggestion is that when the empty bookmark
AttentionLine is deleted, the end result leaves the "Dear REF field" blank
even if there is a variable in the bookmark ReferringPhysician, whereas it
should only be blank if both AttentionLine and ReferringPhysician are
missing.

The sequence should be to use the variable in AttentionLine first. If that
is blank, then use the Referring Physician variable. If both are blank, leave
Dear "REF Field" blank and don't don't pop an error when bookmarks are
deleted.

I don't know if this is possible or not.

Thanks so much for your help!
--
singeredel


macropod said:
Hi singeredel,

The following will suppress the error message in the absence of either or both bookmarks:
{IF{REF AttentionLine}= "Error*" "" {IF{REF AttentionLine}= "" {IF{REF ReferringPhysician}= "Error*" "" {IF{REF ReferringPhysician}=
"" "" {REF ReferringPhysician}}} {REF AttentionLine}}}

Cheers
 
M

macropod

Hi singeredel,

OK, try this construction:
{IF{={IF{REF AttentionLine}= "Error*" 1 0}+{IF{REF AttentionLine}= "" 1 0}}> 0 {IF{={IF{REF ReferringPhysician}= "Error*" 1
0}+{IF{REF ReferringPhysician}= "" 1 0}}> 0 "" {REF ReferringPhysician}} {REF AttentionLine}}

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

singeredel said:
What is happening with this suggestion is that when the empty bookmark
AttentionLine is deleted, the end result leaves the "Dear REF field" blank
even if there is a variable in the bookmark ReferringPhysician, whereas it
should only be blank if both AttentionLine and ReferringPhysician are
missing.

The sequence should be to use the variable in AttentionLine first. If that
is blank, then use the Referring Physician variable. If both are blank, leave
Dear "REF Field" blank and don't don't pop an error when bookmarks are
deleted.

I don't know if this is possible or not.

Thanks so much for your help!
--
singeredel


macropod said:
Hi singeredel,

The following will suppress the error message in the absence of either or both bookmarks:
{IF{REF AttentionLine}= "Error*" "" {IF{REF AttentionLine}= "" {IF{REF ReferringPhysician}= "Error*" "" {IF{REF
ReferringPhysician}=
"" "" {REF ReferringPhysician}}} {REF AttentionLine}}}

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------
PS: None of this is vba.

singeredel said:
Hi again. I need to modify this further to include an IF condition for the
bookmark not being found. The prior nested code works fine until I have to
delete the area in the document where the bookmark turns out to be empty.
When I delete the bookmarked area, it then pops an Error! message that the
reference source is not found. For example, even if the Dear {REF
ReferringPhysician} puts in the name, when I delete the empty text for
AttentionLine that includes the bookmark, I then get an error showing.

i.e., I need it to do nothing and not pop and error if the referenced
bookmark does not exist, so that when I delete the empty line of text that
contains the bookmark, there is not an error.

Attention: (empty variable) -- this bookmark has no information and the
line eventually gets deleted because it is blank.

Referring Physician: Dr. A (variable) -- this bookmark has information
which shows in the REF next to "Dear "

Dear Dr. A: (this becomes an error once the AttentionLine bookmark gets
deleted.

Hope this is clear.

thanks!

--
singeredel


:

I am trying to set up multiple conditions for filling in a REF Field but am
having trouble getting them all to work.

I have two bookmarks: ReferringPhysician and AttentionLine.

Depending on which bookmarks have information in them, I want to reference
that particular information in the REF fields for the bookmarks. There are
three choices:

1. If AttentionLine has information in the bookmark, I want to use that
variable in the REF field.

2. If AttentionLine is blank and ReferringPhysician is not blank, I want to
use the ReferringPhysician variable in the REF field.

3. If both AttentionLine and ReferringPhysician are blank, I want the REF
field to be blank so that it does not generate an Error! message.

This is the code I came up with for the IF statement, but obviously there is
something wrong with the nesting:

{ IF { REF AttentionLine } <>"" {REF AttentionLine } { IF { REF
AttentionLine } = "" AND { REF ReferringPhysician } <>"" { REF
ReferringPhysician } "" } }

Basically, this is how I want it to look:

Attention: (variable AttentionLine)
Referring Physician: (variable ReferringPhysician)

Dear {REF AttentionLine} or {REF ReferringPhysician} or blank

The "Dear REF" is what I am trying to address here.

Hope this is clear and someone can help.

Thank you!
 
S

singeredel

Yes! This works! Thank you so much! Unfortunately, I cannot figure out how to
read this so that I can understand the process and apply it to other
applications, but it does work...
--
singeredel


macropod said:
Hi singeredel,

OK, try this construction:
{IF{={IF{REF AttentionLine}= "Error*" 1 0}+{IF{REF AttentionLine}= "" 1 0}}> 0 {IF{={IF{REF ReferringPhysician}= "Error*" 1
0}+{IF{REF ReferringPhysician}= "" 1 0}}> 0 "" {REF ReferringPhysician}} {REF AttentionLine}}

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

singeredel said:
What is happening with this suggestion is that when the empty bookmark
AttentionLine is deleted, the end result leaves the "Dear REF field" blank
even if there is a variable in the bookmark ReferringPhysician, whereas it
should only be blank if both AttentionLine and ReferringPhysician are
missing.

The sequence should be to use the variable in AttentionLine first. If that
is blank, then use the Referring Physician variable. If both are blank, leave
Dear "REF Field" blank and don't don't pop an error when bookmarks are
deleted.

I don't know if this is possible or not.

Thanks so much for your help!
--
singeredel


macropod said:
Hi singeredel,

The following will suppress the error message in the absence of either or both bookmarks:
{IF{REF AttentionLine}= "Error*" "" {IF{REF AttentionLine}= "" {IF{REF ReferringPhysician}= "Error*" "" {IF{REF
ReferringPhysician}=
"" "" {REF ReferringPhysician}}} {REF AttentionLine}}}

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------
PS: None of this is vba.

Hi again. I need to modify this further to include an IF condition for the
bookmark not being found. The prior nested code works fine until I have to
delete the area in the document where the bookmark turns out to be empty.
When I delete the bookmarked area, it then pops an Error! message that the
reference source is not found. For example, even if the Dear {REF
ReferringPhysician} puts in the name, when I delete the empty text for
AttentionLine that includes the bookmark, I then get an error showing.

i.e., I need it to do nothing and not pop and error if the referenced
bookmark does not exist, so that when I delete the empty line of text that
contains the bookmark, there is not an error.

Attention: (empty variable) -- this bookmark has no information and the
line eventually gets deleted because it is blank.

Referring Physician: Dr. A (variable) -- this bookmark has information
which shows in the REF next to "Dear "

Dear Dr. A: (this becomes an error once the AttentionLine bookmark gets
deleted.

Hope this is clear.

thanks!

--
singeredel


:

I am trying to set up multiple conditions for filling in a REF Field but am
having trouble getting them all to work.

I have two bookmarks: ReferringPhysician and AttentionLine.

Depending on which bookmarks have information in them, I want to reference
that particular information in the REF fields for the bookmarks. There are
three choices:

1. If AttentionLine has information in the bookmark, I want to use that
variable in the REF field.

2. If AttentionLine is blank and ReferringPhysician is not blank, I want to
use the ReferringPhysician variable in the REF field.

3. If both AttentionLine and ReferringPhysician are blank, I want the REF
field to be blank so that it does not generate an Error! message.

This is the code I came up with for the IF statement, but obviously there is
something wrong with the nesting:

{ IF { REF AttentionLine } <>"" {REF AttentionLine } { IF { REF
AttentionLine } = "" AND { REF ReferringPhysician } <>"" { REF
ReferringPhysician } "" } }

Basically, this is how I want it to look:

Attention: (variable AttentionLine)
Referring Physician: (variable ReferringPhysician)

Dear {REF AttentionLine} or {REF ReferringPhysician} or blank

The "Dear REF" is what I am trying to address here.

Hope this is clear and someone can help.

Thank you!
 
M

macropod

Hi singeredel,

To see how to use this technique more generally, and how to do a wide range of other calculations in Word, check out my Word Field
Maths 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=365442
or
http://www.gmayor.com/downloads.htm#Third_party

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

singeredel said:
Yes! This works! Thank you so much! Unfortunately, I cannot figure out how to
read this so that I can understand the process and apply it to other
applications, but it does work...
--
singeredel


macropod said:
Hi singeredel,

OK, try this construction:
{IF{={IF{REF AttentionLine}= "Error*" 1 0}+{IF{REF AttentionLine}= "" 1 0}}> 0 {IF{={IF{REF ReferringPhysician}= "Error*" 1
0}+{IF{REF ReferringPhysician}= "" 1 0}}> 0 "" {REF ReferringPhysician}} {REF AttentionLine}}

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

singeredel said:
What is happening with this suggestion is that when the empty bookmark
AttentionLine is deleted, the end result leaves the "Dear REF field" blank
even if there is a variable in the bookmark ReferringPhysician, whereas it
should only be blank if both AttentionLine and ReferringPhysician are
missing.

The sequence should be to use the variable in AttentionLine first. If that
is blank, then use the Referring Physician variable. If both are blank, leave
Dear "REF Field" blank and don't don't pop an error when bookmarks are
deleted.

I don't know if this is possible or not.

Thanks so much for your help!
--
singeredel


:

Hi singeredel,

The following will suppress the error message in the absence of either or both bookmarks:
{IF{REF AttentionLine}= "Error*" "" {IF{REF AttentionLine}= "" {IF{REF ReferringPhysician}= "Error*" "" {IF{REF
ReferringPhysician}=
"" "" {REF ReferringPhysician}}} {REF AttentionLine}}}

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------
PS: None of this is vba.

Hi again. I need to modify this further to include an IF condition for the
bookmark not being found. The prior nested code works fine until I have to
delete the area in the document where the bookmark turns out to be empty.
When I delete the bookmarked area, it then pops an Error! message that the
reference source is not found. For example, even if the Dear {REF
ReferringPhysician} puts in the name, when I delete the empty text for
AttentionLine that includes the bookmark, I then get an error showing.

i.e., I need it to do nothing and not pop and error if the referenced
bookmark does not exist, so that when I delete the empty line of text that
contains the bookmark, there is not an error.

Attention: (empty variable) -- this bookmark has no information and the
line eventually gets deleted because it is blank.

Referring Physician: Dr. A (variable) -- this bookmark has information
which shows in the REF next to "Dear "

Dear Dr. A: (this becomes an error once the AttentionLine bookmark gets
deleted.

Hope this is clear.

thanks!

--
singeredel


:

I am trying to set up multiple conditions for filling in a REF Field but am
having trouble getting them all to work.

I have two bookmarks: ReferringPhysician and AttentionLine.

Depending on which bookmarks have information in them, I want to reference
that particular information in the REF fields for the bookmarks. There are
three choices:

1. If AttentionLine has information in the bookmark, I want to use that
variable in the REF field.

2. If AttentionLine is blank and ReferringPhysician is not blank, I want to
use the ReferringPhysician variable in the REF field.

3. If both AttentionLine and ReferringPhysician are blank, I want the REF
field to be blank so that it does not generate an Error! message.

This is the code I came up with for the IF statement, but obviously there is
something wrong with the nesting:

{ IF { REF AttentionLine } <>"" {REF AttentionLine } { IF { REF
AttentionLine } = "" AND { REF ReferringPhysician } <>"" { REF
ReferringPhysician } "" } }

Basically, this is how I want it to look:

Attention: (variable AttentionLine)
Referring Physician: (variable ReferringPhysician)

Dear {REF AttentionLine} or {REF ReferringPhysician} or blank

The "Dear REF" is what I am trying to address here.

Hope this is clear and someone can help.

Thank you!
 
S

singeredel

Thank you! Good stuff!
--
singeredel


macropod said:
Hi singeredel,

To see how to use this technique more generally, and how to do a wide range of other calculations in Word, check out my Word Field
Maths 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=365442
or
http://www.gmayor.com/downloads.htm#Third_party

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

singeredel said:
Yes! This works! Thank you so much! Unfortunately, I cannot figure out how to
read this so that I can understand the process and apply it to other
applications, but it does work...
--
singeredel


macropod said:
Hi singeredel,

OK, try this construction:
{IF{={IF{REF AttentionLine}= "Error*" 1 0}+{IF{REF AttentionLine}= "" 1 0}}> 0 {IF{={IF{REF ReferringPhysician}= "Error*" 1
0}+{IF{REF ReferringPhysician}= "" 1 0}}> 0 "" {REF ReferringPhysician}} {REF AttentionLine}}

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

What is happening with this suggestion is that when the empty bookmark
AttentionLine is deleted, the end result leaves the "Dear REF field" blank
even if there is a variable in the bookmark ReferringPhysician, whereas it
should only be blank if both AttentionLine and ReferringPhysician are
missing.

The sequence should be to use the variable in AttentionLine first. If that
is blank, then use the Referring Physician variable. If both are blank, leave
Dear "REF Field" blank and don't don't pop an error when bookmarks are
deleted.

I don't know if this is possible or not.

Thanks so much for your help!
--
singeredel


:

Hi singeredel,

The following will suppress the error message in the absence of either or both bookmarks:
{IF{REF AttentionLine}= "Error*" "" {IF{REF AttentionLine}= "" {IF{REF ReferringPhysician}= "Error*" "" {IF{REF
ReferringPhysician}=
"" "" {REF ReferringPhysician}}} {REF AttentionLine}}}

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------
PS: None of this is vba.

Hi again. I need to modify this further to include an IF condition for the
bookmark not being found. The prior nested code works fine until I have to
delete the area in the document where the bookmark turns out to be empty.
When I delete the bookmarked area, it then pops an Error! message that the
reference source is not found. For example, even if the Dear {REF
ReferringPhysician} puts in the name, when I delete the empty text for
AttentionLine that includes the bookmark, I then get an error showing.

i.e., I need it to do nothing and not pop and error if the referenced
bookmark does not exist, so that when I delete the empty line of text that
contains the bookmark, there is not an error.

Attention: (empty variable) -- this bookmark has no information and the
line eventually gets deleted because it is blank.

Referring Physician: Dr. A (variable) -- this bookmark has information
which shows in the REF next to "Dear "

Dear Dr. A: (this becomes an error once the AttentionLine bookmark gets
deleted.

Hope this is clear.

thanks!

--
singeredel


:

I am trying to set up multiple conditions for filling in a REF Field but am
having trouble getting them all to work.

I have two bookmarks: ReferringPhysician and AttentionLine.

Depending on which bookmarks have information in them, I want to reference
that particular information in the REF fields for the bookmarks. There are
three choices:

1. If AttentionLine has information in the bookmark, I want to use that
variable in the REF field.

2. If AttentionLine is blank and ReferringPhysician is not blank, I want to
use the ReferringPhysician variable in the REF field.

3. If both AttentionLine and ReferringPhysician are blank, I want the REF
field to be blank so that it does not generate an Error! message.

This is the code I came up with for the IF statement, but obviously there is
something wrong with the nesting:

{ IF { REF AttentionLine } <>"" {REF AttentionLine } { IF { REF
AttentionLine } = "" AND { REF ReferringPhysician } <>"" { REF
ReferringPhysician } "" } }

Basically, this is how I want it to look:

Attention: (variable AttentionLine)
Referring Physician: (variable ReferringPhysician)

Dear {REF AttentionLine} or {REF ReferringPhysician} or blank

The "Dear REF" is what I am trying to address here.

Hope this is clear and someone can help.

Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top