ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
|||
|
|||
Global variables
Hello!! I want to create automatically global variables by source code. But I don't know how to do it. Can I do it by creating nodes in the Tools node? (Inside this node is the node GlobalVariables and I thought on creating nodes there with the specified data of each global variable).
Thanks. |
#2
|
|||
|
|||
Quote:
|
#3
|
|||
|
|||
You're right - you can edit the tree structure in tools - then from the GUI's OnApply you can see it calls refreshglobalvariables(); and then buildnodeflexscript(model()); which you'll need to do as well.
The first column is the variable name; 2nd is the data type (see below) and the third is the value. Note the 3rd column is DATATYPE_STRING even when the variable is numeric, and if it's an array type that cell will need to have subnodes containing the array data. Global variable datatypes: 1: Integer 2: Double 3: Treenode 4: String 5: Integer array 6: Double array 7: Treenode array 8: String array |
The Following 2 Users Say Thank You to Jason Lightfoot For This Useful Post: | ||
juan alberto (03-09-2010) |
#4
|
|||
|
|||
Quote:
Thanks !!! |
#5
|
|||
|
|||
Hi Jason,
can you please explain how to use the buildnodeflexscript command to create a global variable by code? I thought it maybe could be like this: buildnodeflexscript("MAIN:/project/model/Tools/GlobalVariables", new global variable(column1, column2, column3)); Thanks! |
#6
|
|||
|
|||
It isn't buildnodeflexscript(model()) that adds the variables - I think that call is just something that should be done after you add a new global variable (maybe to update any references ?)
So you just need to look at the tree and create the nodes yourself as outlined above. |
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
Congshi Wang (11-11-2010) |
Thread | Thread Starter | Forum | Replies | Last Post |
Update of global variables | BenjaminBuecklein | Q&A | 4 | 11-18-2008 03:43 AM |
Limit in the completion hints? Global Tables, Global Variables, etc.? | Tom David | Gripes and Goodies | 6 | 09-09-2008 04:05 PM |
Experimenter variables | Xavier Jackson | Gripes and Goodies | 4 | 09-09-2008 10:00 AM |
State files and global variables | Markus Bans | Q&A | 3 | 07-08-2008 12:22 PM |
GUI & linked variables | Iulian Marin Ion | Q&A | 2 | 11-27-2007 10:23 PM |