@Member in reverse

How to find the last position in a text list up to 99 elements.

View member feedback to this tip.

@Member finds a value's first position in a text list. This formula finds all positions of a string. It works for lists with up to 99 elements.

_listToSearch := "a":"b":"c":"b":
_searchString := "c"; 
_0_to_99 := _digits *+ _digits; 
_1_to_99 := @Subset(_0_to_99; -99); 
(_1_to_99; @Elements(_listToSearch)); 
_list1:= _listToSearch + _1_to_numOfElements; 
_list2 := _searchString + _1_to_numOfElements; 
_list3 := @Replace(_list1;_list2;""); 
_list4 := @Replace(_list1;@Trim(_list3);""); 
(_list4);_list2; _1_to_numOfElements); 
_position :=@If(_positionsString="" ; 


Another way, rather than trying to keep track of all those @Replace calls, is to use @Right:

_listToSearch := "a":"b":"c":"b":"b":"a":"c":"b";
_searchString := "c";
_0_to_99 := _digits *+ _digits;
_1_to_99 := @Subset(_0_to_99; -99);
(_1_to_99; @Elements(_listToSearch));
_list1:= _listToSearch + _1_to_numOfElements;

REM "<-- New code starts here -->";
_locs := @Trim(@Right(_list1; _searchString));
_position := @If(@Elements(_locs) = 0; 
@Replace(_locs; ""; "Not found");
@Subset(_locs; -1));
-- SearchDomino.com member


I wished I'd had this formula about six months ago! (And why couldn't I come up with it myself!?!) This one is definitely a keeper! Thanks!

-- Jo R.


Using @Right instead of @Replace is not a correct substitution for this task:

If you start with the list
    _listToSearch := "a":"b":"xc":"b":"b":"a":"xc":"b";
you will get the same result as using
    _listToSearch := "a":"b":"c":"b":"b":"a":"c":"b"
-- Lothar F.


If you need to work on lists with more than 99 elements, just replace the list that is hold in var "_1_to_99" ("1":"2":.......:"99") with a list that is long enough for your needs; for example, "_1_to_999" ("1":"2":.......:"999")

This is all you need to change!

-- Joachim Rapp

Do you have comments of your own? Let us know.

This tip was submitted to the SearchDomino.com tip library by member Joachim Rapp. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

Dig Deeper on Lotus Notes Domino Formula Language



  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...