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 - or operator

Justin.Witty - Wednesday, July 6, 2011 12:29 PM:

I was using AML to do a query with

<or>
  <state>Released</state>
  <state>Superseded</state>
</or>

but I can't seem to find a way to duplicate this with IOM code. I found I could use newOR() to do this with multiple properties, but not the same property. Does anyone know of a way to do this?

Thanks,
  Justin



Ronan - Wednesday, July 6, 2011 1:16 PM:

Are you sure ORs on the same property doesn't work? Consider emailing [email protected] to report a bug if you are certain of this.

Anyway, here is some working js including a newOR() call on different properties.

var reportRes = innovator.newItem();
reportRes.setAttribute("typeId", typeId);
reportRes.setAttribute("select", "item_number, title, owned_by_id(name), security_classification, created_on, description, cause, consequence, closure_criteria, on_critical_path, state, closed_on, severity");
reportRes.setAttribute("orderBy", "max_consequence desc");
var logicalOr = reportRes.newOR();
logicalOr.setProperty("on_critical_path", "1");
logicalOr.setProperty("severity", "2");
reportRes = reportRes.apply("get");

?
Ronan Jouchet - PLM Consultant, Processia Solutions



dennis - Wednesday, July 6, 2011 2:32 PM:

Could you use the "in" property condition?

affectedItems.setProperty("state", "'Released','Superseded'");
affectedItems.setPropertyCondition("state", "in");



Justin.Witty - Wednesday, July 6, 2011 2:36 PM:

x



Justin.Witty - Wednesday, July 6, 2011 2:46 PM:

That did it, thanks! I don't recall ever seeing the in condition before.



Ronan - Wednesday, July 6, 2011 3:00 PM:

Great! The 2.4.2 Property Attributes section of the Programmers Guide will interest you, have a look. It details all the conditions accepted by Innovator: eq, ne, ge, le, gt, le, like, etc...

?
Ronan Jouchet - PLM Consultant, Processia Solutions