IndexOf Method - SDT Collection

Official Content
This documentation is valid for:

Returns the index associated to a SDT item in a SDT collection.


IndexOf( Item )

Variable based on a SDT item.


It returns the index (numeric value) associated with the Item parameter element of an SDT collection.


In general, the IndexOf method of a SDT Collection is used in conjunction with the Remove method. Once you have the desired index (position in the SDT), you could use the associated Remove method

&index = &sdtCollection.IndexOf(&sdtCollection.CurrentItem)


Objects Procedure object, Transaction object, Web Panel object
Languages .NET, Java, Ruby (up to GeneXus X Evolution 3)

See also

Structured Data Type Methods


This method works with the elements references and not with their contents. This implies that if a variable with a list of SDT is received as a parameter, and a temporary variable is loaded with an item content, IndexOf will return 0 (empty) since this reference is not within the list. It can be useful only the moment the list is loaded.