Filters

How can I filter on "system_number" not equal to "PDC*" and "state" equal to "DRMO" OR "Inactive" ///<SUMMARY> ///On select new delivered component as relationship, filter by System not equal to "PDC*" and  State equal to "DRMO or InActive" ///</SUMMARY> var retObj = new Object(); retObj["system_number"] != { filterValue: "PDC*", isFilterFixed: true }; ****** Need to make not equal to" ****** retObj["state"] = { filterValue: "DRMO", isFilterFixed: true };  ****** Need to include "InActive" ****** return retObj;
  • Hello, It does not appear possible to use a 'not equals' condition within a simple search. In regards to searching on a state of DRMO or Inactive, you can typically do this within a simple search by using a '|' character between your two criteria such as 'DRMO|Inactive'. However, there is a known issue when using a filter like this where the '|' is not properly escaped. With that being said, there are two potential workarounds for this issue.
    1. Perform a search using the Innovator API within the onSearchDialog event using your desired criteria. Parse these results and build an array of the IDs of the items that match your criteria. You can then set a filter using the idlist with a line like inArgs.QryItem.item.setAttribute("idlist",idArray.join(","));
    2. You can load the AML of your criteria directly within the onSearchDialog event. For example: inArgs.QryItem.loadXML("<Item type='MY_ITEMTYPE' action='get' page='1' pagesize='25' maxRecords=''><system_number condition='not like'>PDC%</system_number><OR><state>DRMO</state><state>Inactive</state></OR></Item>");
    Either of these workarounds should let you filter your items by your desired criteria. Chris
    Christopher Gillis Aras Labs Software Engineer
  • Hi Chris, I tried your second example, but the "system_number" doesn't filter. Is that because "system_number" is an item within my itemType and not a string?
  • Hi Dominic, Yes, that would be why. You would want to change the AML for that property to be something like <system_number><Item type='YOUR_ITEMTYPE' action='get' select='id'><keyed_name condition='not like'>PDC%</keyed_name></Item></system_number>. Chris
    Christopher Gillis Aras Labs Software Engineer
  • Hi Chris, For some reason the "is not" condition is acting the opposite, it's showing just PDC. My code is below, any help would be appreciated. TY   inArgs.QryItem.loadXML("<Item type='MIN_Delivered_Component' action='get' page='1' pagesize='25' maxRecords=''><system_number><Item type='MIN_System' action='get' select='id'><keyed_name condition='not like'>PDC%</keyed_name></Item></system_number><OR><state>DRMO</state><state>Inactive</state></OR></Item>");
  • Hello, On further testing, I'm not sure this direct insertion of AML will work for your use case of trying to use the NOT condition. Simple Searches don't support the 'not like' condition, so it seems your criteria of 'PDC%' is being interpreted by the simple search as using the 'like' condition by default. This would still be possible by using my first suggestion of performing a query within the onSearchDialog event and creating a list of valid IDs to pass in to the search dialog. Chris
    Christopher Gillis Aras Labs Software Engineer