ElementCollections - List - GetElementPosition returns not found.
Following code works fine:
eError := list.GetElementAt(4,itfElement => itfElement);
eError := list.GetElementPosition(itfElement := itfElement, udiPosition => index);
foundIndex := index;
But when I want to get the index position of a value, that is present in the list. Method list.GetElementPosition keeps returning NOT FOUND
I am sure I am not using list.GetElementPosition correctly but I cannot find an example of how to use it properly.
This for example fails:
itfElement := IntElementFactory.Create(iValue := 5);
// Following to verify the content of itfElement
Result := __QUERYINTERFACE(itfElement, itfIntElement);
i := itfIntElement.IntValue;
// Results in NOT FOUND
eError := list.GetElementPosition(itfElement := itfElement, udiPosition => index);
Thank you very much for your help.
You will have to iterate through the list until you find a matching element, and then call GetElementPosition() on the Element from the list which is equal to your newly created object.
List.ElementIterator()
IIterator.Next()
IElement.ElementEquals()
List.GetElementPosition()
Please ask further questions in https://forge.codesys.com/forge/talk , I think the Support Link is more for "Support with using Forge"