Gate, Signal, and Inventory Queries
These queries read the state of a gate, a signal, or an inventory location. Each names its object in quotes.
| Query | What it returns |
|---|---|
Gate("X").IsOpen | 1 if the gate is open, 0 if closed. |
Signal("X").Active | 1 if the signal is currently on, 0 if off. |
Inventory("X").Qty("Item") | The quantity of a named item held at an inventory location. |
Inventory("X").OnOrder("Item") | The quantity of that item already on order and still to arrive. |
Inventory("X").Value("Item") | The value of the stock held: quantity times unit cost. |
The three inventory queries take two names: the first is the inventory location, the second is the item held there.
An example of each
Section titled “An example of each”Each line below is a complete piece of action logic, with a // note saying what it does.
The gate and the signal:
// Send work down the main path only while the inbound gate is openIF Gate("Inbound").IsOpen = 1 THEN ROUTE 1 ELSE ROUTE 2 ENDIF
// Hold the entity here until the Go signal is turned onWAIT UNTIL Signal("Go").ActiveThe inventory:
// Raise a reorder flag when the store runs low on widgetsIF Inventory("Store").Qty("Widget") < 20 THEN SET a_Reorder TO 1 ENDIF
// Stock already ordered and still in transitSET a_Incoming TO Inventory("Store").OnOrder("Widget")
// Value tied up in widgets at this locationSET v_TiedUp TO Inventory("Store").Value("Widget")Qty and OnOrder together give the inventory position, which is what a reorder decision should be made against. Counting stock on hand alone reorders the same item again and again while the first order is still on its way:
// Stock on hand plus stock on order, then reorder against that figureSET a_Position TO Inventory("Store").Qty("Widget") + Inventory("Store").OnOrder("Widget")IF a_Position < 20 THEN REQUEST 100 "Widget" FROM "Supplier" ENDIFAn item’s automatic replenishment policy already makes this comparison for you. Reach for these queries when you want to make the decision yourself, or to report on it.

