View Single Post
  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Kent[_2_] Kent[_2_] is offline
external usenet poster
 
Posts: 7
Default Need to nest HYPERLINK within a complex IF (Word 2003/2007)

Peter,
Thanks for the idea. I tried to see if I could find any other similar
approaches with
launching the hyperlinks from within Word, maybe an RPC or OLE method
that
may not be widely published, but to no avail.

At first I was concerned that following your approach would result in
hundreds of 1-2
sentence instructional documents, that would then be included
individually, which would
have been a maintenance nightmare. I had to let the idea stew a while
before I realized
that I could put all of the fragments into one separate document, with
bookmarks for
each piece. I wasn't crazy about having to maintain 2 different
documents, but at
least it helps resolve the nested Hyperlink issue, which does work
now. It also helps
resolve some of the sub-bulleting aspects, where my conditional piece
was already on
a bulleted item, and it contained additional sub-bullets. My previous
IF conditions with
Compares, had to be re-included on each additional sub-bullet,
eventhough I already
knew the parent bullet was for that same condition...

By the way logic works both ways.
Example 1:
{IF {=OR ( { COMPARE { dd_Service } = "'ALL" },{ COMPARE
{ dd_Service } = "UC" }) } = 1
"{INCLUDETEXT "File_of_Includes" bookmarkforUC_1} " ""}
Example 2:
{INCLUDETEXT "File_of_Includes" {IF {=OR ( { COMPARE { dd_Service } =
"'ALL" },
{ COMPARE { dd_Service } = "UC" }) } = 1 "bookmarkforUC_1"
"bookmarkforblanktext" }}

If it was just the need for simple logic, it probably wouldn't matter
which format I'd use.
However, almost all of the pieces I need to include when the
conditions are met, are
within a numbered list, or some form of sub-bulleted numbering. For
some reason,
if I use the format on Example 1, Word maintains my numbered formating
for most. I still
have some issues, but it mostly works. I may have a blank area
following the number if the
condition is false, but it is better than what happens with format for
Example 2, where
it uses at least 2 bullet numbers and displays blank lines for both if
the condition is false.
For example if the comparison is on bullet "C" following A, and B,
Example 1 will only use
that position as "C". If I use the format for Example 2, it uses "C"
and "D", and each subsequent
comparison on the next bullets each use up 2 positions, as well.

I have figured out how to keep the bulleted entry from showing by
positioning the IF condition
prior to the bullet number, by forcing a new line anywhere in the
middle of the IF statement.
But the problem is that the line with the logic preceding the bullet
being displayed uses one
of the sequences, similar to Example 2. Controlling the bulleting is
still very "Ify" (no pun intended).

So, I've figured, it's best to just let the single numbered entry, say
"C", exist without content when the
condition is false. I'm currently using a green high-lighting on the
conditional text, so the
readers will see where the document was being filtered, while they get
used to the format (and
blank lines when the conditions are false... lessor of two evils...).

If you have other thoughts along this line I'd be happy to hear them.
But for now, Thanks for the advise!

Regards,
Kent

On 22 Aug, 07:37, Peter Jamieson
wrote:
I don't think it's /just/ the nesting, because if you INCLUDETEXT a
document (or a bookmarked area within a document) that contains a
HYPERLINK field, the link still functions within the document. If you
nest the INCLUDETEXT in the IF, you still have a problem with the
hyperlinks. But if you do e.g.

{ INCLUDETEXT "the path name of a file containing bookmarked areas that
you want to include.doc" { IF { =OR ( { COMPARE { dd_Service } = "ALL"

},{ COMPARE { dd_Service } = "abc" } ) } = 1 "bookmarkname" "nothing" } }

where "bookmarkname" is a bookmark that marks the text etc. that you
need in this case, and "nothing" is the name of a bookmark that does not
mark any text,

then you may get the results you need. But if you include any styled
text (e.g. text with character styles, text that includes paragraph or
section merks etc.) you will probably need to ensure that the styles are
defined the same way in both documents.

Peter Jamieson

http://tips.pjmsn.me.uk



Kent wrote:
I've got a large process document that I'm using a couple of dropdown
fields to filter the selection to help reduce the volume of content.
The reader can either leave it at the defaults for "ALL" regions and
"ALL" services, or they can select an individual region or service
that they want to focus on.


The complex IF works great, except for the Hyperlinks that are within
a majority of the IF statements that direct the reader to external
supporting details, which render my IFs useless, if I can't get to the
details linked to those sections...


Here's a typical example:
{ IF { =OR ( { COMPARE { dd_Service } = "ALL" },{ COMPARE
{ dd_Service } = "abc" } ) } = 1 "For abc - *do this, that and the
other. Refer to { HYPERLINK "https://some.sharepoint.server/folder/
details%20file.doc" } for more details, then update the status and
more..." "" }


The other Hyperlinks in the document still work fine. When I first put
the hyperlink within the IF statement, it works fine, until I do the
CTRL-A, F9 to refresh the values selected. More specifically, I'm
copying the URL from the previous version of the document that has
descriptive text to show in the normal view, versus the URL. If I
paste it in while looking at the field codes, I see the HYPERLINK
code, but when I toggle it back to normal view, it shows the URL block
rather than the descriptive text. If I paste it in while I'm in the
normal view, I see the descriptive text, and when I toggle to see the
field codes, it looks like the code above. I can toggle back and it
maintains the descriptive text but loses the the Hyperlink Style (blue
underline)... *Then when I select the section, and click F9 to
refresh, and toggle back to field codes, it looks fine with the
HYPERLINK field codes, but when I toggle back to normal view, it just
maintains the descriptive text. It's no longer selectable or clickable
like a hyperlink.


Is it because HYPERLINKs can't be nested, like Barcodes can't be? Or,
is it because the Hyperlink has another pair of quotes that's
confusing the parser (do I need a double-pair to let it process it
once)? Do I need the HYPERLINK within some other field code like a
Function (= ). *I can't find anything on the parser rules for this to
determine what else may work... Any help would be greatly appreciated.
Otherwise, I'm going to have to pull the URLs out of the IFs and let
them be visible even when the rest of the content for that block
isn't... Not very slick...


Best Regards,
Kent- Hide quoted text -


- Show quoted text -