AnsweredAssumed Answered

AFSDK FindElementsByAttribute not working

Question asked by neilg on Feb 18, 2017
Latest reply on Jun 28, 2017 by neilg

Hi All, Hoping someone can point out what I may be doing wrong.


In an AF Database I have an element which has an "AssetID" attribute and a "ModelID" attribute. I am using AF SDK to search for this element by attribute but it is not giving me back the any results.

This element drives from a template called "CB Gas Pressure and Quality" which in turn derives from a base template called "TestBaseTemplate". The AssetID and ModelID are attributes coming from the TestBaseTemplate.


I have a WCF webservice which is making a call to AFSDK using the same code below. The Web Service was not working so I morphed it into a Windows Forms application to see if that was able to find the element but it is not able to do it as well. My initial thoughts were AFCache but I attempted to clear it without any luck.

The code is as per screenshot below (hopefully screenshot comes out clear).


In code I am getting a reference to the root AF element.I am doing a AFDB.Refresh and a AFCache.Clear (as a test). Next I am getting the "TestBaseTemplate". Next I am building a search query based on the base template attributes. Lastly I am making a call to AFElement.FindElementByAttribute but that always comes back with 0 elements. Any idea what I am doing wrong? Security is not an issue.