This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - how to set search criteria for classification property that classification is not Product

rrt - Friday, July 29, 2016 2:27 AM:

hi all

i want to set search criteria for classification for that i know that how to set criteria if i want only item having classification as Product

but how to set search criteria that item classification is other than product

means search all item except item having classification as Product



edonahue - Monday, September 19, 2016 3:54 PM:

Hi R,

You can search for items where the classification is not "Product" by using Advanced Search and the "not equals" or "not like" operator.

 



rrt - Tuesday, September 20, 2016 1:52 AM:

but how do this using javascript code

i write code on property of main item , event-onSerachDialog

but how done classification not as product in javascript code

my code for classification as product

//to set search criteria for product field of dispatch item
//search only product item
//var innovator = parent.thisItem.getInnovator();
var innovator = this.getInnovator();
if (!inArgs.itemContext)
{
    return;
}
var idlist1;
var idlist2="";
var ret_cat_id=inArgs.itemContext.getAttribute("id");

//get item master having classification - Product
var qry1 = innovator.newItem("FM_Item", "get");
qry1.setProperty("classification","Product");
var res = qry1.apply();

//if item master result is empty
if (res.isEmpty())
{
    top.aras.AlertError("No items could be found");
    var Filter = new Object();
    Filter["classification"]={filterValue:"Product", isFilterFixed:true};
    return Filter;
}

if (res.isError())
{
return res;
}

var count=res.getItemCount();
//declare array to set result of item master
var idarray=new Array();

for (i=0;i<count;i++)
{
  var item=res.getItemByIndex(i);
  idarray[i]=item.getID();
   idlist1=idarray.join(",");
}
//to set array to idlist of search dialog
inArgs.QryItem.item.setAttribute("idlist",idlist1);
return("");

so how to get FM_Item having classification other than product , above code work for classification as product



edonahue - Friday, September 23, 2016 5:46 PM:

Hi R,

Try adding the highlighted line to your code:

// get item master having classification != Product
var qry1 = innovator.newItem("FM_Item", "get");
qry1.setProperty("classification","Product");
qry1.setPropertyAttribute("classification","condition","ne");
var res = qry1.apply();

This will ensure your query returns items with a classification "not equal to" the criteria, rather than the default "equal to" operation.



rrt - Wednesday, September 28, 2016 7:35 AM:

thanks Eli Donahue

its works