Lotus Notes FAQ Visit Our Sponsor!

How do you generate a subset of list values based on the contents of another list?

This is useful for getting a subset of roles based on what state a document's workflow is in.

REM "From Damien Katz @ Unity Consulting"
tList1 :=tList1;
tList2 := tList2;
tItemsToKeep :=tItemsToKeep;
REM "Set variable tList1 to the list of values you want scan.";
REM "Set variable tList2 to corresponding list of values that you want to keep.";
REM "Set tItemsToKeep to the values you want ton scan list1 for.";
REM "tFilteredList returns the values from List2 that are kept";

REM "**************************Begin Function";
tListLength := @Elements( tList2);

tDigits := "0" : "1" : "2" : "3" : "4" : "5" : "6" : "7" : "8" : "9";

tNumbers :=  @Subset( @If( tListLength  <= 10; tDigits; tListLength >= 100;  tDigits *+ tDigits; tDigits *+ tDigits *+ tDigits); tListLength ) + "$$";

tMixedListWithNumbers := @Replace( tNumbers *+ tItemsToKeep ; tNumbers + tList1; tNumbers + tList2);
tMixedListWithoutNumbers := @Right( tMixedListWithNumbers; "$$");
tFilteredList := @Trim( @Replace( tMixedListWithoutNumbers ; tItemsToKeep ; ""));
REM "**************************End Function";


Applies to Notes Versions: 3, 4, 4.5, 4.6, 5
Last Modified: February 23, 1998