I don't believe that second `push()` is behaving t...
# suitescript
e
I don't believe that second
push()
is behaving the way you think
t
Hey Eric, how do you mean?
e
Oh, nvm, I've never used it like that; didn't realize
push
accepted multiple params
Not sure what the rest of your filters are, but I would expect the whole filter to look something like
Copy code
var filters = [
  ["isinactive", "isnot", true], "AND", // just an example to illustrate grouping
  [ // group the color filters together
    ["item", "contains", "blue"], "OR",
    ["item", "contains", "red"]
  ]
]
What type of search is this?
t
No worries 🙂 I think I figured out how I can make this happen: I have to say something like filterExpression.push("[itemid, startswith, id], and, [itemid, contains, color], or") for each of the colors in the array, and then do some conditionals if it's the last element etc.etc.
I tried it the way you have it in your code, but the issue was it would stop looking at the "startswith" part after the first or and start returning items that just had that color in the name
e
What type of search?
t
It's an Item Saved Search
e
Would expect the filter name to be
itemid
instead of
item
t
Yeah, that's my fault - I was just typing it up real quick and put item instead but the actual code does have itemid. I'm wondering if I search by "name" instead of "itemid" if it would make a difference.