I'm trying to create a search of all my assembly i...
# suitescript
s
I'm trying to create a search of all my assembly in a specific location current inv on hand, the problem I have is my current search only gives me the lot controlled items I need both lot controlled and not lot controlled. but only showing be the current inv on hand and there lot numbers
Copy code
var assemblyitemSearchObj = search.create({
   type: "assemblyitem",
   filters:
   [
      ["type","anyof","Assembly"], 
      "AND", 
      ["inventorylocation.name","startswith","E-Commerce"], 
      "AND", 
      ["locationquantityavailable","greaterthan","0"], 
      "AND", 
      ["inventorynumber.quantityonhand","greaterthan","0"], 
      "AND", 
      ["inventorynumber.location","anyof","14"]
   ],
   columns:
   [
      search.createColumn({
         name: "itemid",
         sort: search.Sort.ASC,
         label: "Name"
      }),
      search.createColumn({name: "description", label: "Description"}),
      search.createColumn({name: "type", label: "Type"}),
      search.createColumn({name: "locationquantityavailable", label: "Location Available"}),
      search.createColumn({
         name: "location",
         join: "inventoryNumber",
         label: "Location"
      }),
      search.createColumn({
         name: "inventorynumber",
         join: "inventoryNumber",
         label: "Number"
      }),
      search.createColumn({
         name: "itemid",
         join: "memberItem",
         label: "Name"
      }),
      search.createColumn({name: "memberquantity", label: "Member Quantity"}),
      search.createColumn({
         name: "quantityonhand",
         join: "inventoryNumber",
         label: "On Hand"
      }),
      search.createColumn({
         name: "islotitem",
         join: "memberItem",
         label: "Is Lot Numbered Item"
      })
   ]
});
var searchResultCount = assemblyitemSearchObj.runPaged().count;
log.debug("assemblyitemSearchObj result count",searchResultCount);
assemblyitemSearchObj.run().each(function(result){
   // .run().each has a limit of 4,000 results
   return true;
});
b
you have 2 filters that expect values that only exist on inventory numbers
s
i know my problem is how would i write a filter if it is lot controlled apply these filters if not apply these filter
b
your filter expression allows you to use
OR
it allows nested expressions
it allows you to do something like
Copy code
A OR B
or in your case
Copy code
A OR [C AND D AND E]
s
if I'm in the UI so that would be formula
b
you could, but it wouldnt make it easier
e
@Sim Greenbaum if you can create this in the UI (Saved Search) and save it, use this extension to see what the underlying filter expression would look like https://chrome.google.com/webstore/detail/netsuite-search-export/gglbgdfbkaelbjpjkiepdmfaihdokglp?hl=en-US
s
Thanks I was having trouble doing it in the ui
b
message has been deleted
s
thank you