Subject: There is at least one errors in your code
To do the long story short:
a) You start your loop from 0 but end with the number in @Elements => this is one to many (and it takes careful consideration for all the commands used which end is to be adjusted - as to if to start the loop from 0 or 1).
b) From what I know (started doing domino with R3 Beta about 15 years ago) , there is just one good way to display a variable which might contain an in-expected result - With other words, It works very well for me to do it only this way every single time for years now when searching for an error:
@Prompt([OkCancelList]:[NoSort]; “Dialog 1”; “” ; “” ; @Text(category2));
If you would have done so, you would have gotten a more or less understandable error message with an hint on Problem ‘a)’. This is quite helpful in many cases, as for the results of @DBLookup or something, too.
c) There is no need for a loop to do what you most likely wanted to do. Have a look at the following code:
choices := “Domino¥Add-Ons”:
"Domino¥Cross Certs":
"Windows¥3rd Party Software":
"Windows¥FTP Transfers";
category1 := “Domino”;
category2 := category1 + @Trim(@Word (choices + category1; category1 ; 2));
@Prompt([OkCancelList]; “building category2”; “” ; “” ;category2);
However, this would fail, if “Domino” could be within the values right of Domino¥ - like if Choices contains something like
“Domino¥Cross Domino Certs”:
To get around this problem, use this instead (just did not want to start with this, as it is harder to understand (not tested, but I gues you get the idea)
_Separator := “¥”;
category1 := _Separator + “Domino” + _Separator;
category2 := category1 + @Trim(@Word ( (_Separator + choices) + category1; category1 ; 2));
In theory the problem does still exist, but usually a category like this is not to be expected:
“Domino¥Cross ¥Domino¥ Certs”:
One further Tip: If you ever want to report an error and want someone to look at it, try to do so with as little as possible and as obvious code as possible (no you did not do so).