Fastest Search Method for finding Attributes values

Discussion created by kkumar100 on Aug 4, 2009
Latest reply on Aug 10, 2009 by cescamilla


I need your assistance in one issue. As per our requirement I have to create a function which will accept ElementName, CommaSepratedAttributeName and return attribute Values.

In my function I called AFElement.FindElements() method which is returning list of elements, now I started the loop and fetching the attribute values.

But My problem is that it is taking long time. I need a function which will take less time. Please find my code below

PISystems systems = new PISystems();
mySystem = (PISystem)systems[serverName].PISystem;
myDB = (AFDatabase)mySystem.Databases[afDatabase].Database;

string[] strAtrr = commaSepratedAttributes.Split(',');
myElements = (AFElements)myDB.Elements;

AFNamedCollectionList<AFElement> AFElementsList = AFElement.FindElements(myDB, null, elementTemplate, AFSearchField.Template, true, AFSortField.Name, AFSortOrder.Ascending, 1000);

foreach (AFElement Afelement in AFElementsList)
    StrAttrVal = new StringBuilder();
    if (intLen > 0)
        int intLength = 0;
        while (intLength <= intLen)
            string strAttribute = strAtrr[intLength];
            if (intLength < intLen)
            intLength += 1;

Please advise me, Thanks in Advance!!!!.