Coding in flexscript

Coding in flexscript

j08j
Not applicable
63 Views
3 Replies
Message 1 of 4

Coding in flexscript

j08j
Not applicable

[ FlexSim 24.0.2 ]

I have some questions about flexscript coding, how can I execute these steps using flexscript?

1. How to uncheck ”Fire OnResourceAvailable at Simulation Start" in the TaskExecuter panel?screenshot-2024-04-14-at-114838-am.png

2. How to add array label, edit the row number and the number in the array?screenshot-2024-04-14-at-114905-am.pngscreenshot-2024-04-14-at-114951-am.png

3. About the list properties, How can I delete those two expression field? I just want to leave "bound". Also, every time I re-execute the program, I hope to re-create TSList1 instead of continuously generating TSList2, TSList3,..., what can I do?screenshot-2024-04-14-at-114805-am.pngscreenshot-2024-04-14-at-121122-pm.png

Thank you very much in advance.

0 Likes
Accepted solutions (1)
64 Views
3 Replies
Replies (3)
Message 2 of 4

arunTTT2P
Explorer
Explorer
Accepted solution
Object ASRSVeh = Model.find("ASRSvehicle1"); // AsRS Vehicle Ref
ASRSVeh.setProperty("AvailableOnStart",0); // 1 for checking and 0 for unchecking the checkbox 

The set property was found in the property table.

https://docs.flexsim.com/en/24.1/Reference/Tools/PropertyTables/PropertyTables.html#app

ASRSVeh.LabelArray = [1,2,3];//LabelArray is the labelname 

For array operations refer the Flexscript API's

FlexScript Class - Array (flexsim.com)

treenode GlobalLists = Model.find("Tools/GlobalLists"); // Removing all tasksequence lists 
//Before creating new
for(int i=1;i<=GlobalLists.subnodes.length;i++)
{
   string ListType = GlobalLists.subnodes.find(">variables/listType").value;
   if(ListType == "TaskSequence")
    {
      GlobalLists.subnodes.destroy();
    }
}


treenode list = Tools.create("List","TaskSequence");// Tools API
treenode focus = list;
string fieldTypeName = "ExpressionField";
treenode newField = function_s(focus, "addField", fieldTypeName);
newField.name = "bound";
treenode Expression = newField.find("expression");
string Code = "/**Custom Code*/ Variant value = param(1);\
   Variant puller = param(2);\
   treenode entry = param(3);\
  double pushTime = param(4);\
   return 5;";
   Expression.value = Code;
 list.find(">variables/fields/age").destroy(); // Removing first two fields
 list.find(">variables/fields/distance").destroy();
Message 3 of 4

moehlmann_fe
Observer
Observer
Rather than removing the tow default fields, you can also just create a general list instead. The only difference between the list types is what fields they possess by default and which fields are available to add via dropdown menu.
Message 4 of 4

j08j
Not applicable

Thanks for the clarification!

0 Likes