{INDEX} "\s" field switch anomaly

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

{INDEX} "\s" field switch anomaly

Post by ChrisGreaves »

This thread https://answers.microsoft.com/en-us/mso ... 2037d226d6 and its 3 replies suggest that both the {INDEX} and {TOC} switches have been poorly implemented in the past, although as Hans has noted, at least one of the bugs from Word2003 is fixed in Word2019.
(I am scheduled to be upgrading to 2019 sometime in 2046).

Meanwhile back at the ranch ...
I can't make the {INDEX \s } switch generate anything other than a zero.
33.png
34.png
I tried with the \s string with, and without double-quotes.

I documented outside Eileen's Lounge "Unrelated, I think, to the {SEQ} field." but put the four {SEQ} fields in just in case I was wrong.

OK "{INDEX} switch anomaly" is a dead issue because
(1) I am 20 years behind the times and
(2) These switch failures are documented elsewhere on the web.

I note that some web pages basically reprint the Help files (https://bettersolutions.com/word/fields/index-field.htm) but their examples do not work (for me) in Word2003).

Bottom line: Do not assume that {INDEX} and {TOC} switches work as advertised.

:coffeetime:
Chris
You do not have the required permissions to view the files attached to this post.
An expensive day out: Wallet and Grimace

User avatar
HansV
Administrator
Posts: 78235
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: {INDEX} "\s" field switch anomaly

Post by HansV »

This too works correctly in Word 2019.

What happens if you press Ctrl+A then F9 to update all fields in the document?
Best wishes,
Hans

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: {INDEX} "\s" field switch anomaly

Post by ChrisGreaves »

HansV wrote:
04 Oct 2021, 09:31
This too works correctly in Word 2019.
Thanks Hans.
I have to ask, were you using the switches exactly as I had them, or creating your own test document?
What happens if you press Ctrl+A then F9 to update all fields in the document?
I see no change. Frankly I am getting tired of Ctrl+A, F9, scroll to results, not to mention my "Toggle All" Macro (Tools, Options, View, set everything to NOT cbFieldCodes, ...)

I made quite a few tests on \s switch because I had found several web pages that complained that \s wasn't working. I may have missed a Ctrl+A F9, easy to do, but I would have got the other nine :grin:

I have attached two documents with my draft notes on these two fields, trying to get my head around what I have to do to automate this stuff. There's nothing heavy in there, just notes in the event anyone else is stupid brave enough to tackle automation of these two fields.

Cheers
Chris
You do not have the required permissions to view the files attached to this post.
An expensive day out: Wallet and Grimace

User avatar
HansV
Administrator
Posts: 78235
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: {INDEX} "\s" field switch anomaly

Post by HansV »

I created a test document of several pages, marked two words as index entries (generating XE fields), and sprinkled some { SEQ Chapter } fields through the document. then I generate an index { INDEX \s Chapter } and pressed F9. The sequence numbers were included correctly in the index.

S0802.png
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: {INDEX} "\s" field switch anomaly

Post by ChrisGreaves »

HansV wrote:
04 Oct 2021, 20:34
I created a test document of several pages, marked two words as index entries (generating XE fields), and sprinkled some { SEQ Chapter } fields through the document. then I generate an index { INDEX \s Chapter } and pressed F9. The sequence numbers were included correctly in the index.
Untitled.png
Thank you, Hans. I got it to work with "Chapter" and then with "Bonavista".
I was wrong in my assertion that "(There appears to be a bug, which I have documented elsewhere , \s seems always to generate the value “0”). Unrelated, I think, to the {SEQ} field."
I am not sure what I was thinking of at the time. Probably doped out on the lack of detail and/or example in the Word2003 Help screens, aided and abetted by the negative comments on {TOC} and {Index} fields in stale web pages.

Cheers
Chris
You do not have the required permissions to view the files attached to this post.
An expensive day out: Wallet and Grimace