Please provide some elaborative details about finding AF element by reference along with examples, as I could not understandproperly from AF SDK help.
I guess you are referring to the AFElement.FindElementByReferenceType method. AFReferenceType is the defines the link between a parent element and a child element. By default, PI AF has 3 reference type defined, Parent-Child, Composition and Weak Reference, you can create more reference type that suits your requirement. there is an example for creating a new reference type and linking a parent and child element using the reference in the AF SDK Programming Reference, under AFReferenceType object.
You can first get the AFReferenceType from the AFDatabase, and provide it as a parameter for AFElement.FindElementByReferenceType method like:
PISystems systems = new PISystems();PISystem afserver = systems["<AF Server Name>"];AFDatabase database = afserver.Databases["AF Database Name>"];// get reference type from AF DatabaseAFReferenceType parentchild = database.ReferenceTypes["Parent-Child"];// search by reference typeAFNamedCollectionList<AFElement> elements = AFElement.FindElementsByReferenceType(database, null, parentchild, AFSortField.Name, AFSortOrder.Ascending, 100);
Retrieving data ...