AnsweredAssumed Answered

FindElementsByAttribute with AFEnumeration query attribute

Question asked by MaximeHT on Feb 24, 2016
Latest reply on Mar 8, 2016 by MaximeHT

With AFSDK V2.6, the FindElementsByAttribute function dosn't seem to work when at least one of the query attributes is typed AFEnumerationSet.

 

Is there another way to get the following code working?

 

 

try

            {

                listeDonnees.Clear();

 

                PI_MessageLogger.GetInstance().WriteDebug("Chargement dans " + this.cheminElementRacine);

                AFElement elementAF_Racine = this.interface_PIAF.AFDB.Elements[this.cheminElementRacine];

 

                do

                {

                    // Find the elements and load the attributes we will be using.

                    AFAttributeValueQuery avq1 = new AFAttributeValueQuery(template.AttributeTemplates["Code_point_de_réference"], searchOperator, "IR0010");

                    AFAttributeValueQuery avq2 = new AFAttributeValueQuery(template.AttributeTemplates["Type_de_donnée"], searchOperator, "Indice de Wobbe");//TEST 1) Type = AF Enumeration  ==> DOESN'T WORK !!!!!!

                    //AFAttributeValueQuery avq2 = new AFAttributeValueQuery(template.AttributeTemplates["Publication_active"], searchOperator, true);//TEST 2) Type = Boolean ==>  WORKS !

 

                    AFAttributeValueQuery[] attributeValueQueryTable = new AFAttributeValueQuery[2] { avq1, avq2};

 

                    AFNamedCollectionList<AFElement> myElements = AFElement.FindElementsByAttribute(elementAF_Racine, "*" , attributeValueQueryTable, searchFullHierarchy, AFSortField.Name, AFSortOrder.Ascending, maxCount);

 

                    if (myElements == null) // --> Count = 0 if AF Enumeration is used!!!!

                    {

                        break;

                    }

                    else

                    {

                        // Once the elements are loaded, we can process them.

                        this.chargerListeAvecElements(listeDonnees, myElements);

 

                        startIndex += pageSize; // Advance to next page.

                    }

                } while (startIndex < this.totalCount);

 

            }

            catch (ThreadAbortException ex)

            {

                throw ex;

            }

            catch (Exception ex)

            {

                foundOK = false;

                PI_MessageLogger.GetInstance().WriteException(new System.Diagnostics.StackFrame(), ex, "Une exception est survenue durant la lecture des données AF.");

            }

 

 

Thanks

Outcomes