Table of Contents

Table of Contents

FlexScript Class - Storage.System

Storage.System

Description

A class that represents a storage system.

For more information on how to use the storage system, see the Storage System topic.

Properties

storageObjects Accesses all storage objects in the model as an array of Storage.Objects.

Methods

findItem Finds an item matching one of the given queries.
findSlot Finds a slot that matches one of the given queries.
getSlot Gets a slot by its address.
queryItems Searches for all items that match the query.
querySlots Searches for all slots that match a query.

Details

Do no remove, this fixes the anchor on doc.flexsim.com

Storage.System.storageObjects

readonly storageObjects

Description

Accesses all storage objects in the model as an array of Storage.Objects.

Do no remove, this fixes the anchor on doc.flexsim.com

Storage.System.findItem()

Storage.Slot.Item findItem( Variant queries , int flags )
Storage.Slot.Item findItem( Variant queries , int flags , Variant $1 )
Storage.Slot.Item findItem( Variant queries , int flags , Variant $1 , Variant $2 )
Storage.Slot.Item findItem( Variant queries , int flags , Variant $1 , Variant $2 , Variant $3 )
Storage.Slot.Item findItem( Variant queries , int flags , Variant $1 , Variant $2 , Variant $3 , Variant $4 )
Storage.Slot.Item findItem( Variant queries , int flags , Variant $1 , Variant $2 , Variant $3 , Variant $4 , Variant $5 )

Parameters

queries One or more queries to use to find an item. One query can be passed in as a string. Multiple must be passed in an array.
flags Reserved for future use. Must be 0.
$1-$5 Values passed in, which can be referenced in the queries.

Returns

Storage.Slot.Item A reference to the first matching slot item. If the search was unsuccesful, this value will be empty.

Description

Finds an item matching one of the given queries.

This method evaluates each query until a slot item is found that matches. Only stored items are searched.

'$' Keywords

In composing the query, you can include the values $1 - $5. These values are associated with additional parameters that you pass into the query.

Storage.system.findItem("WHERE SKU = $1 AND Size = $2", 0, token.SKU, token.Size);

'item' Keyword

The query parser will interpret 'item' is a special keyword that accesses the target item that is being evaluated, as a Storage.Slot.Item. This can be used to write normal flexscript expressions as part of the query.

Storage.system.findItem("WHERE item.slot.SKU = $1", 0, token.SKU);

Accessing Label Names

Other than the 'item' keyword and the '$' keywords, all other values in the query are interpreted to be labels on the evaluating flow item. For example, to search for items that have a Type label value of 5, you could use the following code:

Storage.Slot.Item slotItem = Storage.system.findItem("WHERE Type = 5");

If you are virtualizing items, then you should make sure those items are included in the list of item labels to save.

Speed Considerations

It should be noted that evaluating a label directly by its name effects a result no different than accessing it via the 'item' keyword. In other words, the two queries below will give the same result (assuming you are not virtualizing items).

WHERE SKU = 5
WHERE item.item.SKU = 5

However, these two expressions can have different results in speed, especially when searching large storage systems. Accessing the SKU label directly (the first query above) will enable indexed lookup if you have indexed that label. On the other hand, using the expression 'item.item.SKU' will compile to a straight flexscript evaluation, which cannot be indexed. Thus, using the direct label access is preferable.

Do no remove, this fixes the anchor on doc.flexsim.com

Storage.System.findSlot()

Storage.Slot findSlot( Variant queries , int flags )
Storage.Slot findSlot( Variant queries , int flags , Variant $1 )
Storage.Slot findSlot( Variant queries , int flags , Variant $1 , Variant $2 )
Storage.Slot findSlot( Variant queries , int flags , Variant $1 , Variant $2 , Variant $3 )
Storage.Slot findSlot( Variant queries , int flags , Variant $1 , Variant $2 , Variant $3 , Variant $4 )
Storage.Slot findSlot( Variant queries , int flags , Variant $1 , Variant $2 , Variant $3 , Variant $4 , Variant $5 )

Parameters

queries One or more queries to use to find a slot. One query can be passed in as a string. Multiple must be passed in an array.
flags Reserved for future use. Must be 0.
$1-$5 Values passed in, which can be referenced in the queries.

Returns

Storage.Slot A reference to the first matching slot. If the search was unsuccesful, this value will be empty.

Description

Finds a slot that matches one of the given queries.

This method evaluates each query until a slot is found that matches. Only storable slots are searched.

'$' Keywords

In composing the query, you can include the values $1 - $5. These values are associated with additional parameters that you pass into the query.

Storage.system.findSlot("WHERE SKU = $1 AND Size = $2", 0, token.SKU, token.Size);

'slot' Keyword

The query parser will interpret 'slot' as a special keyword that accesses the target slot that is being evaluated, as a Storage.Slot. This can be used to write normal flexscript expressions as part of the query.

Storage.system.findItem("WHERE slot.hasSpace($1)", 0, token.Item);

Accessing Label Names

Other than the 'slot' keyword and the '$' keywords, all other values in the query are interpreted to be labels on the evaluating slot. For example, to search for slots that have a Type label value of 5, you could use the following code:

Storage.Slot.Item slotItem = Storage.system.findItem("WHERE Type = 5");

Speed Considerations

It should be noted that evaluating a label directly by its name effects a result no different than accessing it via the 'slot' keyword. In other words, the two queries below will give the same result.

WHERE SKU = 5
WHERE slot.SKU = 5

However, these two expressions can have different results in speed, especially when searching large storage systems. Accessing the SKU label directly (the first query above) will enable indexed lookup if you have indexed that label. On the other hand, using the expression 'slot.SKU' will compile to a straight flexscript evaluation, which cannot be indexed. Thus, using the direct label access is preferable. Indeed, in some cases it may be advantageous to avoid using the 'slot' keyword, and instead store desired values on labels on the slot, specifically to take advantage of indexed lookup.

Do no remove, this fixes the anchor on doc.flexsim.com

Storage.System.getSlot()

Storage.Slot getSlot( string address )

Parameters

address An address that can be interpreted by one of the address schemes.

Returns

Storage.Slot

Description

Gets a slot by its address.

This method compares the address to each Address Scheme. If it matches, this method then tries to resolve the slot using the scheme.
Do no remove, this fixes the anchor on doc.flexsim.com

Storage.System.queryItems()

Variant queryItems( string query , int flags )
Variant queryItems( string query , int flags , Variant $1 )
Variant queryItems( string query , int flags , Variant $1 , Variant $2 )
Variant queryItems( string query , int flags , Variant $1 , Variant $2 , Variant $3 )
Variant queryItems( string query , int flags , Variant $1 , Variant $2 , Variant $3 , Variant $4 )
Variant queryItems( string query , int flags , Variant $1 , Variant $2 , Variant $3 , Variant $4 , Variant $5 )

Parameters

query The query to run.
flags Reserved for future use. Must be 0.
$1-$5 Extra parameters that can be referenced in the query.

Returns

Variant An array of Storage.Slot.Item values.

Description

Searches for all items that match the query.

The method only considers items that are in the Stored state.
Do no remove, this fixes the anchor on doc.flexsim.com

Storage.System.querySlots()

Variant querySlots( string query , int flags )
Variant querySlots( string query , int flags , Variant $1 )
Variant querySlots( string query , int flags , Variant $1 , Variant $2 )
Variant querySlots( string query , int flags , Variant $1 , Variant $2 , Variant $3 )
Variant querySlots( string query , int flags , Variant $1 , Variant $2 , Variant $3 , Variant $4 )
Variant querySlots( string query , int flags , Variant $1 , Variant $2 , Variant $3 , Variant $4 , Variant $5 )

Parameters

query The query to run
flags Reserved for future use. Must be 0.
$1-$5 Extra paramemters that can be referenced in the query.

Returns

Variant An array of Storage.Slot values.

Description

Searches for all slots that match a query.

This method only considers storable slots.