SetComponentKey
Called to setup a collection, keyed by the user property userPropName
.
GetComponentByKey
and SetComponentKey
only works with transport equipment, not with products.
To find product try the function GetProductFromID where identifier
parameter is product.Identifier
.
🔁 Function
void SetComponentKey(userPropName: string);
⚙️ Parameters
Name | Type | Description |
---|---|---|
userPropName |
String | The name of the user property that is to be the key value |
↩️ Return Value
None
📝 Example
function OnSimulationStart() {
SetComponentKey("LocationID");
}
function ProductTracking(msg, hdr) {
var product = UpdateProductPosition(GetComponentByKey("LocationID", msg.locationid), msg.distance, msg.BC);
if (product != null) {
product.Text = msg.BC;
product.Length = msg.l;
product.Width = msg.w;
product.Height = msg.h;
product.Direction = msg.d;
}
}