Computation needed
I need a Computation that counts the number of instances of a repeated series that uses the While express and not the Repeat instruction.
Why not just use the Repeated Instruction?
For some context, before you migrate from Developer to HD Author, you need to consider refactoring your Repeat Instructions by removing the Repeat Instruction and replacing it with the While expression. If you have complex nested dialog structures (especially in systems where the "Link variables to dialog" setting on dialogs is turned off), then you may encounter that the HotDocs interview will not handle this computation.
Sample Computation Variables
To give some structure to this sample computation, the repeated series I need to count is named "PartyRepeatedDialog." This dialog contains one variable called "PartyFirstNameTextVariable."
The Count function is great, but many times, I need to count the number of things within a group (e.g., if there is a group of Kittens, I may need to count just the Kittens with green eyes).
Here are the two scripts that do the same thing. If you are migrating to Advance from Developer, you may need to refactor your count computations to use a WHILE instruction rather than a REPEAT instruction.
The HotDocs documentation still needs to be updated to reflect when the WHILE instruction vs. REPEAT instruction should be used for this purpose. Also, since the WHILE instruction will be necessary for some circumstances, it would be useful if the documentation for author could provide another example (https://help.hotdocs.com/preview/help/WHILE_Instruction.htm#:~:text=The%20WHILE%20instruction%20tells%20HotDocs,be%20used%20in%20the%20template.).
Sample Scenario
We need to count the number kittens with blue eyes.
Repeat Instruction Script
0
REPEAT KittensDialog
IF KittenEyeColor = "Blue"
RESULT + 1
END IF
END REPEAT
WHILE Instruction Script - you need to create a local number variable. Here it is called "KittenCounter"
SET KittenCounter TO 1
0
WHILE ANSWERED(KittenEyeColor[KittenCounter])
RESULT + 1
INCREMENT KittenCounter
END WHILE
Sometimes you can get away with the instruction COUNT(DialogName) depending on how the dialogs are structured and scripted, and depending on where you want to use this number value specifically. I tend to try this before writing a basic while loop.