xmlCriteria example to filter data

Hello,

I am creating a tool to synchronize a .csv data file with the Ayanova parts table. I’m having trouble with the “GetList” method in the “Parts” class. Each string that I’ve tried for the xmlCriteria returns my query empty. Can you provide me with an example of how the xmlCriteria should be formatted?

<<Public Shared Function GetList ( xmlCriteria As String ) As PartList>>

Thank you for the help, in advance

Hi there, there is a (supposed to be) documented feature to assist with xml criteria: There is a control key combination that will display the xml criteria used in any of the main grid lists in AyaNova: control-alt-g which will pop up a copyable message box displaying the current xlm criteria being used for the current list in AyaNova.

So what you can do is filter and sort the grid in AyaNova as you want to use it in code then press control alt g and get the actual criteria text. Note that some of it relates to the UI level and is ignored by the actual method (i.e. the “pin”, “width” etc).

For example using the sample data, I go to the inventory panel in AyaNova, select parts, filter by part category “virtual reality”, create a custom filter on the retail price for parts only greater than $50.00 and get a resulting list displayed with what I want, I press control-alt-g and get this:

<?xml version=“1.0” encoding=“utf-16” standalone=“yes”?>
<GRIDCRITERIA>
<COLUMNITEM CM=“aPartCategory.aName” UI=“LT_O_PartCategory” PIN=“0” WIDTH=“114” SORT=“ASC” />
<COLUMNITEM CM=“aPart.aPartNumber” UI=“LT_Part_Label_PartNumber” PIN=“0” WIDTH=“111” />
<COLUMNITEM CM=“aPart.aName” UI=“LT_O_Part” PIN=“0” WIDTH=“135” />
<COLUMNITEM CM=“aManufacturers.aName” UI=“LT_Part_Label_ManufacturerID” PIN=“0” WIDTH=“114” />
<COLUMNITEM CM=“aWholesalers.aName” UI=“LT_Part_Label_WholesalerID” PIN=“0” WIDTH=“104” />
<COLUMNITEM CM=“aUnitOfMeasure.aName” UI=“LT_O_UnitOfMeasure” PIN=“0” WIDTH=“127” />
<COLUMNITEM CM=“aPart.aTrackSerialNumber” UI=“LT_Part_Label_TrackSerialNumber” PIN=“0” WIDTH=“151” />
<COLUMNITEM CM=“aPart.aActive” UI=“LT_Part_Label_Active” PIN=“0” WIDTH=“78” />
<COLUMNITEM CM=“aPart.aManufacturerNumber” UI=“LT_Part_Label_ManufacturerNumber” PIN=“0” WIDTH=“157” />
<COLUMNITEM CM=“aPart.aRetail” UI=“LT_Part_Label_Retail” PIN=“0” WIDTH=“79” />
<COLUMNITEM CM=“aPartAssembly.aName” UI=“LT_O_PartAssembly” PIN=“0” WIDTH=“120” />
<COLUMNITEM CM=“aPart.aAlternativeWholesalerNumber” UI=“LT_Part_Label_AlternativeWholesalerNumber” PIN=“0” WIDTH=“204” />
<COLUMNITEM CM=“aPart.aCost” UI=“LT_Part_Label_Cost” PIN=“0” WIDTH=“79” />
<COLUMNITEM CM=“grid” UI=“LT_Part_Label_Custom1” PIN=“0” WIDTH=“106” />
<COLUMNITEM CM=“grid” UI=“LT_Part_Label_Custom2” PIN=“0” WIDTH=“106” />
<COLUMNITEM CM=“grid” UI=“LT_Part_Label_Custom3” PIN=“0” WIDTH=“106” />
<COLUMNITEM CM=“grid” UI=“LT_Part_Label_Custom4” PIN=“0” WIDTH=“106” />
<COLUMNITEM CM=“grid” UI=“LT_Part_Label_Custom5” PIN=“0” WIDTH=“106” />
<COLUMNITEM CM=“grid” UI=“LT_Part_Label_Custom6” PIN=“0” WIDTH=“106” />
<COLUMNITEM CM=“grid” UI=“LT_Part_Label_Custom7” PIN=“0” WIDTH=“106” />
<COLUMNITEM CM=“grid” UI=“LT_Part_Label_Custom8” PIN=“0” WIDTH=“106” />
<COLUMNITEM CM=“grid” UI=“LT_Part_Label_Custom9” PIN=“0” WIDTH=“106” />
<COLUMNITEM CM=“grid” UI=“LT_Part_Label_Custom0” PIN=“0” WIDTH=“106” />
<COLUMNITEM CM=“aPart.aWholesalerNumber” UI=“LT_Part_Label_WholesalerNumber” PIN=“0” WIDTH=“147” />
<COLUMNITEM CM=“AALTERNATIVEWHOLESALERS.aName” UI=“LT_Part_Label_AlternativeWholesalerID” PIN=“0” WIDTH=“161” />
<COLUMNITEM CM=“aPart.aUPC” UI=“LT_Part_Label_UPC” PIN=“0” WIDTH=“71” />
<WHEREITEMGROUP GROUPLOGICALOPERATOR=“And” UI=“LT_O_PartCategory”>
<WHEREITEM COMPAREOPERATOR=“Equals” CM=“aPartCategory.aID” UICOMPAREVALUE=“Virtual reality” TYPE=“System.Guid” COMPAREVALUE="{EE095055-BE3F-4906-8AED-99F42A83E16C}" />
</WHEREITEMGROUP>
<WHEREITEMGROUP GROUPLOGICALOPERATOR=“And” UI=“LT_Part_Label_Retail”>
<WHEREITEM COMPAREOPERATOR=“GreaterThan” CM=“aPart.aRetail” UI=“LT_Part_Label_Retail” TYPE=“System.Decimal” UICOMPAREVALUE="" COMPAREVALUE=“50” />
</WHEREITEMGROUP>
</GRIDCRITERIA>
Which I can then feed as a string directly to the getlist method of the part list. Note that the columnitems are used mostly for UI display however they also affect the sql sort order (at least the first three columns do).

All that being said unless you need to filter or sort or retrieve less fundamental data about the parts I would recommend using the PartPickList object instead if you just want a list of id’s and names and some other minor info about parts as it’s a much lighter and simpler to use object.

Post #5222