A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Syntax is Wrong but I Cannot See it



 
 
Thread Tools Display Modes
  #1  
Old March 8th, 2010, 11:59 AM posted to microsoft.public.word.mailmerge.fields
David A Wood
external usenet poster
 
Posts: 2
Default Syntax is Wrong but I Cannot See it

Hi

I have a field with 4 choice answers in a dropdown list

"Not Applicable"
"Broadly Compliant"
"Non compliant - minor risk"
"Non compliant - major risk"

Using multiple "IF" I have used the following code -

{IF{Article21Dropdown} = "Broadly compliant" " The responsible person had
ensured that his employees were provided with adequate safety training in a
manner appropriate to the risk identified by the risk assessment. "
{IF(Article21Dropdown} = " Non compliant - minor risk " " The responsible
person had not ensured that, where a dangerous substance was present in the
premises, the risk to relevant persons was eliminated or reduced so far as
was reasonably practicable." {IF{Article21Dropdown} = "Non compliant - major
risk" "The responsible person had not ensured that, where a dangerous
substance was present in the premises, the risk to relevant persons was
eliminated or reduced so far as was reasonably practicable." " "}"}"}

The aim?
"Not Applicable" - returns blank
"Broadly Compliant" - returns "The responsible person had ensured etc"..

Next two choices return the same text line "The responsible person had not
ensured that,... etc"

Have succeeded with a three state IF but failed with this..

Thanks for any help forthcoming.












  #2  
Old March 8th, 2010, 12:36 PM posted to microsoft.public.word.mailmerge.fields
Graham Mayor
external usenet poster
 
Posts: 18,297
Default Syntax is Wrong but I Cannot See it

There are a few issues in your example
1. The first dropdown entry is 'Broadly Compliant' yet your IF field is
looking for 'Broadly compliant'. The searches are case sensitive. To get
round that add a \*Lower formatting switch and put the search all in lower
case (see later)
2. {IF(Article21Dropdown} = " Non compliant - minor risk " has unwanted
spaces between the quotes and the text.
3. As the major and minor risk options reproduce the same text you can use a
wildcard in the search e.g. = "non compliant*"
4. It probably makes better sense here to use a sequence of conditional
fields on the same line rather than nested fields as there are only four
possible results from three conditional fields.
Thus:

{ IF { Article21Dropdown \*lower } = "not applicable" ""}{ IF{
Article21Dropdown \*lower } = "broadly compliant" "The responsible person
had ensured that his employees were provided with adequate safety training
in a manner appropriate to the risk identified by the risk assessment.
" }{ IF{ Article21Dropdown \*lower } = "non compliant*" "The responsible
person had not ensured that, where a dangerous substance was present in the
premises, the risk to relevant persons was eliminated or reduced so far as
was reasonably practicable."}

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




"David A Wood" wrote in message
...
Hi

I have a field with 4 choice answers in a dropdown list

"Not Applicable"
"Broadly Compliant"
"Non compliant - minor risk"
"Non compliant - major risk"

Using multiple "IF" I have used the following code -

{IF{Article21Dropdown} = "Broadly compliant" " The responsible person
had
ensured that his employees were provided with adequate safety training in
a
manner appropriate to the risk identified by the risk assessment. "
{IF(Article21Dropdown} = " Non compliant - minor risk " " The responsible
person had not ensured that, where a dangerous substance was present in
the
premises, the risk to relevant persons was eliminated or reduced so far as
was reasonably practicable." {IF{Article21Dropdown} = "Non compliant -
major
risk" "The responsible person had not ensured that, where a dangerous
substance was present in the premises, the risk to relevant persons was
eliminated or reduced so far as was reasonably practicable." " "}"}"}

The aim?
"Not Applicable" - returns blank
"Broadly Compliant" - returns "The responsible person had ensured etc"..

Next two choices return the same text line "The responsible person had not
ensured that,... etc"

Have succeeded with a three state IF but failed with this..

Thanks for any help forthcoming.














  #3  
Old March 8th, 2010, 09:07 PM posted to microsoft.public.word.mailmerge.fields
macropod[_2_]
external usenet poster
 
Posts: 2,402
Default Syntax is Wrong but I Cannot See it

You could actually reduce the coding to just two IF tests:
{IF{Article21Dropdown}= B* "The responsible person had ensured that his employees were provided with adequate safety training in a
manner appropriate to the risk identified by the risk assessment."}
{IF{Article21Dropdown}= Non* "The responsible person had not ensured that, where a dangerous substance was present in the premises,
the risk to relevant persons was eliminated or reduced so far as was reasonably practicable."}

Notes:
1. The field coding shows the absolute minimum code you'd need for the tests.
2. I've separated the fields into separate lines here for clarity but, in practice, they'd go on the same line.
3. I've omitted Graham's case conversions - with dropdown formfields there should never be any doubt as to the case of the chosen
response.
4. All the field brace pairs (ie '{ }') are created via Ctrl-F9 - you can't simply type them or copy & paste them from this message.


--
Cheers
macropod
[Microsoft MVP - Word]


"Graham Mayor" wrote in message ...
There are a few issues in your example
1. The first dropdown entry is 'Broadly Compliant' yet your IF field is looking for 'Broadly compliant'. The searches are case
sensitive. To get round that add a \*Lower formatting switch and put the search all in lower case (see later)
2. {IF(Article21Dropdown} = " Non compliant - minor risk " has unwanted spaces between the quotes and the text.
3. As the major and minor risk options reproduce the same text you can use a wildcard in the search e.g. = "non compliant*"
4. It probably makes better sense here to use a sequence of conditional fields on the same line rather than nested fields as there
are only four possible results from three conditional fields.
Thus:

{ IF { Article21Dropdown \*lower } = "not applicable" ""}{ IF{ Article21Dropdown \*lower } = "broadly compliant" "The responsible
person had ensured that his employees were provided with adequate safety training in a manner appropriate to the risk identified
by the risk assessment. " }{ IF{ Article21Dropdown \*lower } = "non compliant*" "The responsible person had not ensured that,
where a dangerous substance was present in the premises, the risk to relevant persons was eliminated or reduced so far as was
reasonably practicable."}

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




"David A Wood" wrote in message ...
Hi

I have a field with 4 choice answers in a dropdown list

"Not Applicable"
"Broadly Compliant"
"Non compliant - minor risk"
"Non compliant - major risk"

Using multiple "IF" I have used the following code -

{IF{Article21Dropdown} = "Broadly compliant" " The responsible person had
ensured that his employees were provided with adequate safety training in a
manner appropriate to the risk identified by the risk assessment. "
{IF(Article21Dropdown} = " Non compliant - minor risk " " The responsible
person had not ensured that, where a dangerous substance was present in the
premises, the risk to relevant persons was eliminated or reduced so far as
was reasonably practicable." {IF{Article21Dropdown} = "Non compliant - major
risk" "The responsible person had not ensured that, where a dangerous
substance was present in the premises, the risk to relevant persons was
eliminated or reduced so far as was reasonably practicable." " "}"}"}

The aim?
"Not Applicable" - returns blank
"Broadly Compliant" - returns "The responsible person had ensured etc"..

Next two choices return the same text line "The responsible person had not
ensured that,... etc"

Have succeeded with a three state IF but failed with this..

Thanks for any help forthcoming.















  #4  
Old March 9th, 2010, 06:26 AM posted to microsoft.public.word.mailmerge.fields
Graham Mayor
external usenet poster
 
Posts: 18,297
Default Syntax is Wrong but I Cannot See it

If you use only 2 IF tests, ignoring the test for 'Not Applicable' then you
cannot go back and change your mind to Not Applicable from one of the other
selected options. The value of the IF field will remain until a different
value is forced upon it.

I agree about the \*lower case switch with dropdown fields but I was
demonstrating the wider point about the importance of case - this being one
of the problems in the OPs version..

I agree also that you can shorten the text with the wildcard, but my
personal preference is not to do so unneccesarily, as it is then easier for
a third party - or me for that matter - who may later need to edit the
form, to see what was intended.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"macropod" wrote in message
...
You could actually reduce the coding to just two IF tests:
{IF{Article21Dropdown}= B* "The responsible person had ensured that his
employees were provided with adequate safety training in a manner
appropriate to the risk identified by the risk assessment."}
{IF{Article21Dropdown}= Non* "The responsible person had not ensured that,
where a dangerous substance was present in the premises, the risk to
relevant persons was eliminated or reduced so far as was reasonably
practicable."}

Notes:
1. The field coding shows the absolute minimum code you'd need for the
tests.
2. I've separated the fields into separate lines here for clarity but, in
practice, they'd go on the same line.
3. I've omitted Graham's case conversions - with dropdown formfields there
should never be any doubt as to the case of the chosen response.
4. All the field brace pairs (ie '{ }') are created via Ctrl-F9 - you
can't simply type them or copy & paste them from this message.


--
Cheers
macropod
[Microsoft MVP - Word]


"Graham Mayor" wrote in message
...
There are a few issues in your example
1. The first dropdown entry is 'Broadly Compliant' yet your IF field is
looking for 'Broadly compliant'. The searches are case sensitive. To get
round that add a \*Lower formatting switch and put the search all in
lower case (see later)
2. {IF(Article21Dropdown} = " Non compliant - minor risk " has unwanted
spaces between the quotes and the text.
3. As the major and minor risk options reproduce the same text you can
use a wildcard in the search e.g. = "non compliant*"
4. It probably makes better sense here to use a sequence of conditional
fields on the same line rather than nested fields as there are only four
possible results from three conditional fields.
Thus:

{ IF { Article21Dropdown \*lower } = "not applicable" ""}{ IF{
Article21Dropdown \*lower } = "broadly compliant" "The responsible person
had ensured that his employees were provided with adequate safety
training in a manner appropriate to the risk identified by the risk
assessment. " }{ IF{ Article21Dropdown \*lower } = "non compliant*" "The
responsible person had not ensured that, where a dangerous substance was
present in the premises, the risk to relevant persons was eliminated or
reduced so far as was reasonably practicable."}

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




"David A Wood" wrote in message
...
Hi

I have a field with 4 choice answers in a dropdown list

"Not Applicable"
"Broadly Compliant"
"Non compliant - minor risk"
"Non compliant - major risk"

Using multiple "IF" I have used the following code -

{IF{Article21Dropdown} = "Broadly compliant" " The responsible person
had
ensured that his employees were provided with adequate safety training
in a
manner appropriate to the risk identified by the risk assessment. "
{IF(Article21Dropdown} = " Non compliant - minor risk " " The
responsible
person had not ensured that, where a dangerous substance was present in
the
premises, the risk to relevant persons was eliminated or reduced so far
as
was reasonably practicable." {IF{Article21Dropdown} = "Non compliant -
major
risk" "The responsible person had not ensured that, where a dangerous
substance was present in the premises, the risk to relevant persons was
eliminated or reduced so far as was reasonably practicable." " "}"}"}

The aim?
"Not Applicable" - returns blank
"Broadly Compliant" - returns "The responsible person had ensured etc"..

Next two choices return the same text line "The responsible person had
not
ensured that,... etc"

Have succeeded with a three state IF but failed with this..

Thanks for any help forthcoming.

















  #5  
Old March 9th, 2010, 09:10 AM posted to microsoft.public.word.mailmerge.fields
David A Wood
external usenet poster
 
Posts: 2
Default Syntax is Wrong but I Cannot See it

Great replies - thanks to both of you for the assistance - priceless!!

Regards

David


"Graham Mayor" wrote:

If you use only 2 IF tests, ignoring the test for 'Not Applicable' then you
cannot go back and change your mind to Not Applicable from one of the other
selected options. The value of the IF field will remain until a different
value is forced upon it.

I agree about the \*lower case switch with dropdown fields but I was
demonstrating the wider point about the importance of case - this being one
of the problems in the OPs version..

I agree also that you can shorten the text with the wildcard, but my
personal preference is not to do so unneccesarily, as it is then easier for
a third party - or me for that matter - who may later need to edit the
form, to see what was intended.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"macropod" wrote in message
...
You could actually reduce the coding to just two IF tests:
{IF{Article21Dropdown}= B* "The responsible person had ensured that his
employees were provided with adequate safety training in a manner
appropriate to the risk identified by the risk assessment."}
{IF{Article21Dropdown}= Non* "The responsible person had not ensured that,
where a dangerous substance was present in the premises, the risk to
relevant persons was eliminated or reduced so far as was reasonably
practicable."}

Notes:
1. The field coding shows the absolute minimum code you'd need for the
tests.
2. I've separated the fields into separate lines here for clarity but, in
practice, they'd go on the same line.
3. I've omitted Graham's case conversions - with dropdown formfields there
should never be any doubt as to the case of the chosen response.
4. All the field brace pairs (ie '{ }') are created via Ctrl-F9 - you
can't simply type them or copy & paste them from this message.


--
Cheers
macropod
[Microsoft MVP - Word]


"Graham Mayor" wrote in message
...
There are a few issues in your example
1. The first dropdown entry is 'Broadly Compliant' yet your IF field is
looking for 'Broadly compliant'. The searches are case sensitive. To get
round that add a \*Lower formatting switch and put the search all in
lower case (see later)
2. {IF(Article21Dropdown} = " Non compliant - minor risk " has unwanted
spaces between the quotes and the text.
3. As the major and minor risk options reproduce the same text you can
use a wildcard in the search e.g. = "non compliant*"
4. It probably makes better sense here to use a sequence of conditional
fields on the same line rather than nested fields as there are only four
possible results from three conditional fields.
Thus:

{ IF { Article21Dropdown \*lower } = "not applicable" ""}{ IF{
Article21Dropdown \*lower } = "broadly compliant" "The responsible person
had ensured that his employees were provided with adequate safety
training in a manner appropriate to the risk identified by the risk
assessment. " }{ IF{ Article21Dropdown \*lower } = "non compliant*" "The
responsible person had not ensured that, where a dangerous substance was
present in the premises, the risk to relevant persons was eliminated or
reduced so far as was reasonably practicable."}

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




"David A Wood" wrote in message
...
Hi

I have a field with 4 choice answers in a dropdown list

"Not Applicable"
"Broadly Compliant"
"Non compliant - minor risk"
"Non compliant - major risk"

Using multiple "IF" I have used the following code -

{IF{Article21Dropdown} = "Broadly compliant" " The responsible person
had
ensured that his employees were provided with adequate safety training
in a
manner appropriate to the risk identified by the risk assessment. "
{IF(Article21Dropdown} = " Non compliant - minor risk " " The
responsible
person had not ensured that, where a dangerous substance was present in
the
premises, the risk to relevant persons was eliminated or reduced so far
as
was reasonably practicable." {IF{Article21Dropdown} = "Non compliant -
major
risk" "The responsible person had not ensured that, where a dangerous
substance was present in the premises, the risk to relevant persons was
eliminated or reduced so far as was reasonably practicable." " "}"}"}

The aim?
"Not Applicable" - returns blank
"Broadly Compliant" - returns "The responsible person had ensured etc"..

Next two choices return the same text line "The responsible person had
not
ensured that,... etc"

Have succeeded with a three state IF but failed with this..

Thanks for any help forthcoming.

















.

  #6  
Old March 9th, 2010, 09:27 AM posted to microsoft.public.word.mailmerge.fields
Graham Mayor
external usenet poster
 
Posts: 18,297
Default Syntax is Wrong but I Cannot See it

You are welcome

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


"David A Wood" wrote in message
...
Great replies - thanks to both of you for the assistance - priceless!!

Regards

David


"Graham Mayor" wrote:

If you use only 2 IF tests, ignoring the test for 'Not Applicable' then
you
cannot go back and change your mind to Not Applicable from one of the
other
selected options. The value of the IF field will remain until a different
value is forced upon it.

I agree about the \*lower case switch with dropdown fields but I was
demonstrating the wider point about the importance of case - this being
one
of the problems in the OPs version..

I agree also that you can shorten the text with the wildcard, but my
personal preference is not to do so unneccesarily, as it is then easier
for
a third party - or me for that matter - who may later need to edit
the
form, to see what was intended.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"macropod" wrote in message
...
You could actually reduce the coding to just two IF tests:
{IF{Article21Dropdown}= B* "The responsible person had ensured that his
employees were provided with adequate safety training in a manner
appropriate to the risk identified by the risk assessment."}
{IF{Article21Dropdown}= Non* "The responsible person had not ensured
that,
where a dangerous substance was present in the premises, the risk to
relevant persons was eliminated or reduced so far as was reasonably
practicable."}

Notes:
1. The field coding shows the absolute minimum code you'd need for the
tests.
2. I've separated the fields into separate lines here for clarity but,
in
practice, they'd go on the same line.
3. I've omitted Graham's case conversions - with dropdown formfields
there
should never be any doubt as to the case of the chosen response.
4. All the field brace pairs (ie '{ }') are created via Ctrl-F9 - you
can't simply type them or copy & paste them from this message.


--
Cheers
macropod
[Microsoft MVP - Word]


"Graham Mayor" wrote in message
...
There are a few issues in your example
1. The first dropdown entry is 'Broadly Compliant' yet your IF field
is
looking for 'Broadly compliant'. The searches are case sensitive. To
get
round that add a \*Lower formatting switch and put the search all in
lower case (see later)
2. {IF(Article21Dropdown} = " Non compliant - minor risk " has
unwanted
spaces between the quotes and the text.
3. As the major and minor risk options reproduce the same text you can
use a wildcard in the search e.g. = "non compliant*"
4. It probably makes better sense here to use a sequence of
conditional
fields on the same line rather than nested fields as there are only
four
possible results from three conditional fields.
Thus:

{ IF { Article21Dropdown \*lower } = "not applicable" ""}{ IF{
Article21Dropdown \*lower } = "broadly compliant" "The responsible
person
had ensured that his employees were provided with adequate safety
training in a manner appropriate to the risk identified by the risk
assessment. " }{ IF{ Article21Dropdown \*lower } = "non compliant*"
"The
responsible person had not ensured that, where a dangerous substance
was
present in the premises, the risk to relevant persons was eliminated
or
reduced so far as was reasonably practicable."}

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




"David A Wood" wrote in message
...
Hi

I have a field with 4 choice answers in a dropdown list

"Not Applicable"
"Broadly Compliant"
"Non compliant - minor risk"
"Non compliant - major risk"

Using multiple "IF" I have used the following code -

{IF{Article21Dropdown} = "Broadly compliant" " The responsible
person
had
ensured that his employees were provided with adequate safety
training
in a
manner appropriate to the risk identified by the risk assessment. "
{IF(Article21Dropdown} = " Non compliant - minor risk " " The
responsible
person had not ensured that, where a dangerous substance was present
in
the
premises, the risk to relevant persons was eliminated or reduced so
far
as
was reasonably practicable." {IF{Article21Dropdown} = "Non
compliant -
major
risk" "The responsible person had not ensured that, where a dangerous
substance was present in the premises, the risk to relevant persons
was
eliminated or reduced so far as was reasonably practicable." " "}"}"}

The aim?
"Not Applicable" - returns blank
"Broadly Compliant" - returns "The responsible person had ensured
etc"..

Next two choices return the same text line "The responsible person
had
not
ensured that,... etc"

Have succeeded with a three state IF but failed with this..

Thanks for any help forthcoming.

















.



  #7  
Old March 9th, 2010, 10:21 AM posted to microsoft.public.word.mailmerge.fields
macropod[_2_]
external usenet poster
 
Posts: 2,402
Default Syntax is Wrong but I Cannot See it

Hi Graham,

I don't follow your meaning:
If you use only 2 IF tests, ignoring the test for 'Not Applicable' then you
cannot go back and change your mind to Not Applicable from one of the other
selected options.

With a dropdown, one can always go back and change the selected option. With your:
{ IF { Article21Dropdown \*lower } = "not applicable" ""}
I can't see the benefit of having a test that chooses between outputting "" (an empty result) or ... nothing.


--
Cheers
macropod
[Microsoft MVP - Word]


"Graham Mayor" wrote in message ...
If you use only 2 IF tests, ignoring the test for 'Not Applicable' then you
cannot go back and change your mind to Not Applicable from one of the other
selected options. The value of the IF field will remain until a different
value is forced upon it.

I agree about the \*lower case switch with dropdown fields but I was
demonstrating the wider point about the importance of case - this being one
of the problems in the OPs version..

I agree also that you can shorten the text with the wildcard, but my
personal preference is not to do so unneccesarily, as it is then easier for
a third party - or me for that matter - who may later need to edit the
form, to see what was intended.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"macropod" wrote in message
...
You could actually reduce the coding to just two IF tests:
{IF{Article21Dropdown}= B* "The responsible person had ensured that his
employees were provided with adequate safety training in a manner
appropriate to the risk identified by the risk assessment."}
{IF{Article21Dropdown}= Non* "The responsible person had not ensured that,
where a dangerous substance was present in the premises, the risk to
relevant persons was eliminated or reduced so far as was reasonably
practicable."}

Notes:
1. The field coding shows the absolute minimum code you'd need for the
tests.
2. I've separated the fields into separate lines here for clarity but, in
practice, they'd go on the same line.
3. I've omitted Graham's case conversions - with dropdown formfields there
should never be any doubt as to the case of the chosen response.
4. All the field brace pairs (ie '{ }') are created via Ctrl-F9 - you
can't simply type them or copy & paste them from this message.


--
Cheers
macropod
[Microsoft MVP - Word]


"Graham Mayor" wrote in message
...
There are a few issues in your example
1. The first dropdown entry is 'Broadly Compliant' yet your IF field is
looking for 'Broadly compliant'. The searches are case sensitive. To get
round that add a \*Lower formatting switch and put the search all in
lower case (see later)
2. {IF(Article21Dropdown} = " Non compliant - minor risk " has unwanted
spaces between the quotes and the text.
3. As the major and minor risk options reproduce the same text you can
use a wildcard in the search e.g. = "non compliant*"
4. It probably makes better sense here to use a sequence of conditional
fields on the same line rather than nested fields as there are only four
possible results from three conditional fields.
Thus:

{ IF { Article21Dropdown \*lower } = "not applicable" ""}{ IF{
Article21Dropdown \*lower } = "broadly compliant" "The responsible person
had ensured that his employees were provided with adequate safety
training in a manner appropriate to the risk identified by the risk
assessment. " }{ IF{ Article21Dropdown \*lower } = "non compliant*" "The
responsible person had not ensured that, where a dangerous substance was
present in the premises, the risk to relevant persons was eliminated or
reduced so far as was reasonably practicable."}

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




"David A Wood" wrote in message
...
Hi

I have a field with 4 choice answers in a dropdown list

"Not Applicable"
"Broadly Compliant"
"Non compliant - minor risk"
"Non compliant - major risk"

Using multiple "IF" I have used the following code -

{IF{Article21Dropdown} = "Broadly compliant" " The responsible person
had
ensured that his employees were provided with adequate safety training
in a
manner appropriate to the risk identified by the risk assessment. "
{IF(Article21Dropdown} = " Non compliant - minor risk " " The
responsible
person had not ensured that, where a dangerous substance was present in
the
premises, the risk to relevant persons was eliminated or reduced so far
as
was reasonably practicable." {IF{Article21Dropdown} = "Non compliant -
major
risk" "The responsible person had not ensured that, where a dangerous
substance was present in the premises, the risk to relevant persons was
eliminated or reduced so far as was reasonably practicable." " "}"}"}

The aim?
"Not Applicable" - returns blank
"Broadly Compliant" - returns "The responsible person had ensured etc"..

Next two choices return the same text line "The responsible person had
not
ensured that,... etc"

Have succeeded with a three state IF but failed with this..

Thanks for any help forthcoming.

















  #8  
Old March 9th, 2010, 10:48 AM posted to microsoft.public.word.mailmerge.fields
Graham Mayor
external usenet poster
 
Posts: 18,297
Default Syntax is Wrong but I Cannot See it

Apologies. I have re-checked and you are correct. When I checked earlier,
selecting Not Applicable did not clear the value from a previous choice of
one of the other options. Unfortunately I have scrapped the original test
document and so I can't re-test with the original conditions to see what the
difference was in that document .

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




"macropod" wrote in message
...
Hi Graham,

I don't follow your meaning:
If you use only 2 IF tests, ignoring the test for 'Not Applicable' then
you cannot go back and change your mind to Not Applicable from one of the
other selected options.

With a dropdown, one can always go back and change the selected option.
With your:
{ IF { Article21Dropdown \*lower } = "not applicable" ""}
I can't see the benefit of having a test that chooses between outputting
"" (an empty result) or ... nothing.


--
Cheers
macropod
[Microsoft MVP - Word]


"Graham Mayor" wrote in message
...
If you use only 2 IF tests, ignoring the test for 'Not Applicable' then
you cannot go back and change your mind to Not Applicable from one of the
other selected options. The value of the IF field will remain until a
different value is forced upon it.

I agree about the \*lower case switch with dropdown fields but I was
demonstrating the wider point about the importance of case - this being
one of the problems in the OPs version..

I agree also that you can shorten the text with the wildcard, but my
personal preference is not to do so unneccesarily, as it is then easier
for a third party - or me for that matter - who may later need to
edit the form, to see what was intended.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"macropod" wrote in message
...
You could actually reduce the coding to just two IF tests:
{IF{Article21Dropdown}= B* "The responsible person had ensured that his
employees were provided with adequate safety training in a manner
appropriate to the risk identified by the risk assessment."}
{IF{Article21Dropdown}= Non* "The responsible person had not ensured
that, where a dangerous substance was present in the premises, the risk
to relevant persons was eliminated or reduced so far as was reasonably
practicable."}

Notes:
1. The field coding shows the absolute minimum code you'd need for the
tests.
2. I've separated the fields into separate lines here for clarity but,
in practice, they'd go on the same line.
3. I've omitted Graham's case conversions - with dropdown formfields
there should never be any doubt as to the case of the chosen response.
4. All the field brace pairs (ie '{ }') are created via Ctrl-F9 - you
can't simply type them or copy & paste them from this message.


--
Cheers
macropod
[Microsoft MVP - Word]


"Graham Mayor" wrote in message
...
There are a few issues in your example
1. The first dropdown entry is 'Broadly Compliant' yet your IF field is
looking for 'Broadly compliant'. The searches are case sensitive. To
get round that add a \*Lower formatting switch and put the search all
in lower case (see later)
2. {IF(Article21Dropdown} = " Non compliant - minor risk " has unwanted
spaces between the quotes and the text.
3. As the major and minor risk options reproduce the same text you can
use a wildcard in the search e.g. = "non compliant*"
4. It probably makes better sense here to use a sequence of conditional
fields on the same line rather than nested fields as there are only
four possible results from three conditional fields.
Thus:

{ IF { Article21Dropdown \*lower } = "not applicable" ""}{ IF{
Article21Dropdown \*lower } = "broadly compliant" "The responsible
person had ensured that his employees were provided with adequate
safety training in a manner appropriate to the risk identified by the
risk assessment. " }{ IF{ Article21Dropdown \*lower } = "non
compliant*" "The responsible person had not ensured that, where a
dangerous substance was present in the premises, the risk to relevant
persons was eliminated or reduced so far as was reasonably
practicable."}

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




"David A Wood" wrote in message
...
Hi

I have a field with 4 choice answers in a dropdown list

"Not Applicable"
"Broadly Compliant"
"Non compliant - minor risk"
"Non compliant - major risk"

Using multiple "IF" I have used the following code -

{IF{Article21Dropdown} = "Broadly compliant" " The responsible
person had
ensured that his employees were provided with adequate safety training
in a
manner appropriate to the risk identified by the risk assessment. "
{IF(Article21Dropdown} = " Non compliant - minor risk " " The
responsible
person had not ensured that, where a dangerous substance was present
in the
premises, the risk to relevant persons was eliminated or reduced so
far as
was reasonably practicable." {IF{Article21Dropdown} = "Non compliant -
major
risk" "The responsible person had not ensured that, where a dangerous
substance was present in the premises, the risk to relevant persons
was
eliminated or reduced so far as was reasonably practicable." " "}"}"}

The aim?
"Not Applicable" - returns blank
"Broadly Compliant" - returns "The responsible person had ensured
etc"..

Next two choices return the same text line "The responsible person had
not
ensured that,... etc"

Have succeeded with a three state IF but failed with this..

Thanks for any help forthcoming.

















  #9  
Old March 9th, 2010, 11:01 AM posted to microsoft.public.word.mailmerge.fields
macropod[_2_]
external usenet poster
 
Posts: 2,402
Default Syntax is Wrong but I Cannot See it

That's OK - you had me wondering for a while if there was some obscure detail I'd missed.

--
Cheers
macropod
[Microsoft MVP - Word]


"Graham Mayor" wrote in message ...
Apologies. I have re-checked and you are correct. When I checked earlier,
selecting Not Applicable did not clear the value from a previous choice of
one of the other options. Unfortunately I have scrapped the original test
document and so I can't re-test with the original conditions to see what the
difference was in that document .

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




"macropod" wrote in message
...
Hi Graham,

I don't follow your meaning:
If you use only 2 IF tests, ignoring the test for 'Not Applicable' then
you cannot go back and change your mind to Not Applicable from one of the
other selected options.

With a dropdown, one can always go back and change the selected option.
With your:
{ IF { Article21Dropdown \*lower } = "not applicable" ""}
I can't see the benefit of having a test that chooses between outputting
"" (an empty result) or ... nothing.


--
Cheers
macropod
[Microsoft MVP - Word]


"Graham Mayor" wrote in message
...
If you use only 2 IF tests, ignoring the test for 'Not Applicable' then
you cannot go back and change your mind to Not Applicable from one of the
other selected options. The value of the IF field will remain until a
different value is forced upon it.

I agree about the \*lower case switch with dropdown fields but I was
demonstrating the wider point about the importance of case - this being
one of the problems in the OPs version..

I agree also that you can shorten the text with the wildcard, but my
personal preference is not to do so unneccesarily, as it is then easier
for a third party - or me for that matter - who may later need to
edit the form, to see what was intended.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"macropod" wrote in message
...
You could actually reduce the coding to just two IF tests:
{IF{Article21Dropdown}= B* "The responsible person had ensured that his
employees were provided with adequate safety training in a manner
appropriate to the risk identified by the risk assessment."}
{IF{Article21Dropdown}= Non* "The responsible person had not ensured
that, where a dangerous substance was present in the premises, the risk
to relevant persons was eliminated or reduced so far as was reasonably
practicable."}

Notes:
1. The field coding shows the absolute minimum code you'd need for the
tests.
2. I've separated the fields into separate lines here for clarity but,
in practice, they'd go on the same line.
3. I've omitted Graham's case conversions - with dropdown formfields
there should never be any doubt as to the case of the chosen response.
4. All the field brace pairs (ie '{ }') are created via Ctrl-F9 - you
can't simply type them or copy & paste them from this message.


--
Cheers
macropod
[Microsoft MVP - Word]


"Graham Mayor" wrote in message
...
There are a few issues in your example
1. The first dropdown entry is 'Broadly Compliant' yet your IF field is
looking for 'Broadly compliant'. The searches are case sensitive. To
get round that add a \*Lower formatting switch and put the search all
in lower case (see later)
2. {IF(Article21Dropdown} = " Non compliant - minor risk " has unwanted
spaces between the quotes and the text.
3. As the major and minor risk options reproduce the same text you can
use a wildcard in the search e.g. = "non compliant*"
4. It probably makes better sense here to use a sequence of conditional
fields on the same line rather than nested fields as there are only
four possible results from three conditional fields.
Thus:

{ IF { Article21Dropdown \*lower } = "not applicable" ""}{ IF{
Article21Dropdown \*lower } = "broadly compliant" "The responsible
person had ensured that his employees were provided with adequate
safety training in a manner appropriate to the risk identified by the
risk assessment. " }{ IF{ Article21Dropdown \*lower } = "non
compliant*" "The responsible person had not ensured that, where a
dangerous substance was present in the premises, the risk to relevant
persons was eliminated or reduced so far as was reasonably
practicable."}

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




"David A Wood" wrote in message
...
Hi

I have a field with 4 choice answers in a dropdown list

"Not Applicable"
"Broadly Compliant"
"Non compliant - minor risk"
"Non compliant - major risk"

Using multiple "IF" I have used the following code -

{IF{Article21Dropdown} = "Broadly compliant" " The responsible
person had
ensured that his employees were provided with adequate safety training
in a
manner appropriate to the risk identified by the risk assessment. "
{IF(Article21Dropdown} = " Non compliant - minor risk " " The
responsible
person had not ensured that, where a dangerous substance was present
in the
premises, the risk to relevant persons was eliminated or reduced so
far as
was reasonably practicable." {IF{Article21Dropdown} = "Non compliant -
major
risk" "The responsible person had not ensured that, where a dangerous
substance was present in the premises, the risk to relevant persons
was
eliminated or reduced so far as was reasonably practicable." " "}"}"}

The aim?
"Not Applicable" - returns blank
"Broadly Compliant" - returns "The responsible person had ensured
etc"..

Next two choices return the same text line "The responsible person had
not
ensured that,... etc"

Have succeeded with a three state IF but failed with this..

Thanks for any help forthcoming.

















 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:28 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.