Deleting the selected items form ListBox

Hi, Can any one help in revmoving the selected items from a list box…

i am adding items to listbox from Names variable…

the selected items in list box also should be removed from the Names variable…

Thanks in advance for Help

Subject: Deleting the selected items form ListBox

You have NamesField, ListboxField and button.

First switch ListboxField “Refresh choices on document refresh” option on.

Set choices to “Use formula for choices”, then put following formula into choices formula window:

nums := “0”:“1”:“2”:“3”:“4”:“5”:“6”:“7”:“8”:“9”;

vector := @Subset(nums *+ nums; -99);

@If(NamesField = “”; “”; NamesField + “|” + @Subset(vector; @Elements(NamesField)))

Then create button and give him following formula:

FIELD NamesField := NamesField;

@If(ListboxField = “”; @Return(“”); “”);

Index := @TextToNumber(ListboxField);

Elem := @Elements(NamesField);

@If(Index = 1;

Value := @If(Elem = 1; “”; @Subset(NamesField; (Elem -1) * (-1)));

Index = Elem;

Value := @Subset(NamesField; (Elem -1));

Value := @Subset(NamesField; (Index -1)) : @Subset(NamesField; (Elem - Index) * (-1))

);

@SetField(“NamesField”; Value);

@Command([ViewRefreshFields])

Notice: If you expect more then 99 names in NamesField, you must resize vector.