Problem with SET & REF function

Oct 19, 2021
Reaction score
I am working on a legal document that is composed of multiple 'parts' that consist of a starting .docx file, then three additional .blk files allowing the document to print as a single document. So the entire document is made up as follows:

.blk - (this is the document part in question - "MAIN.blk")

On the second of the three .blk files (I'll refer to as MAIN.blk), there are multiple 'INCLUDETEXT' functions within IF statements that reference additional .blk files based upon whether those additional files are required. Each of these 'INCLUDETEXT' documents reference 'Exhibits', which may vary in number depending on situation. I am attempting to get the Exhibit letters to display in order across all these parts by using a 'SET Exhibit' function and then 'REF Exhibit' to display the letter.

I have initialized the variable by { SET Exhibit "0" } on the MAIN.blk document, and then do the following when looking to reference the exhibit within the document {SET Exhibit { = { REF Exhibit } + 1 } }{REF Exhibit \* ALPHABETIC} to start at 'A' and proceed through the letters across all parts of the document.

The problem I am running into is that while the first 'INCLUDTEXT' displays the exhibit letters in order as expected, the second one does not - where I expect it to start with 'C' it instead prints 'D' and I can't figure out why? I have referenced the Exhibit at the end of the first INCLUDETEXT before returning back to the MAIN.blk document and it shows that the Exhibit is still at 'B' (as expected). I then reference the Exhibit again in the MAIN.blk document before the second 'INCLUDETEXT' is called, and again it shows the Exhibit is 'B' - which is expected at this point. However when the second INCLUDETEXT document is called, and I reference the Exhibit at the start of the document before anything else has been done, it suddenly shows the Exhibit as 'C' - though there is no SET (or any other) function that has been used at this point to change the Exhibit letter. This then causes my document to skip a letter because I'm later attempting to add to the Exhibit value before printing it where I actually need it.

In my testing I have been able to isolate what was happening by replaced the MAIN.blk document with another document to try and replicate the issue without all of the additional code, but then it prints the exhibits as expected. So the disconnect appears to be with the MAIN.blk document part - but MAIN.blk does not manipulate the Exhibit variable beyond the initial SET function. I even removed the SET function from the MAIN.blk and moved it to the document called in the first INCLUDETEXT instead, but it had no effect as the Exhibit letters still printed out of order starting with the second INCLUDETEXT.

I'm not certain if this is a bug or if there is some other feature/reason that I am just unaware of that would cause this to happen. Again I would not expect the Exhibit variable to be modified unless it was specifically acted upon, but something is triggering it to be changed.

Any help or ideas would be greatly appreciated.



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