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
|
|||
|
|||
Use a variable for a hotlink
Hi,
I'm trying to use a global variable a a part of a hotlink like this: MAIN:/project/model/ProcessorX>variables/cycletime To specify the number X of the chosen Processor the user should type a number in a textbox which updates a global variable called recent_processor_number. And how can I integrate this global variable into the hotlink? I've tried it like this but it didn't work: concat("MAIN:/project/model/Processor",numtostring(recent_processor_number),"> variables/cycletime") the command numtostring(recent_processor_number) should deliver the number X of the chosen processor. Thanks a lot! |
#2
|
||||
|
||||
Attached is a model that shows how you can link an edit field in a GUI to a global variable. It uses a coldlinkx, but you could also use hotlinkx if you wanted a hot link instead.
|
The Following 4 Users Say Thank You to Phil BoBo For This Useful Post: | ||
Stefan Trabut (06-22-2011) |
#3
|
|||
|
|||
Thanks for the code, I used it for a text box to update the global variable.
Now I'm trying the integer value of a global variable (that I can now update from a textbox) for a hotlink from a script window to a chosen node. The global variable like recent_processor_number should be part of the path in the hotlink. Thanks |
#4
|
||||
|
||||
You can use a hotlinkx instead of a normal hotlink. Write code in your hotlinkx to return the node you want to point to.
such as: switch(recent_processor_number) { case 1: return node("/Processor1",model()); case 2: return node("/Combiner7",model()); } or return node(concat("/Processor",numtostring(recent_processor_number,0,0 )),model()); |
The Following User Says Thank You to Phil BoBo For This Useful Post: | ||
Congshi Wang (11-10-2010) |
Thread | Thread Starter | Forum | Replies | Last Post |
global variable in DLL (UserFuncs.h) | Esther Bennett | Q&A | 7 | 09-12-2012 07:02 PM |
Variable for Flexsim Object | Congshi Wang | Q&A | 3 | 08-03-2010 09:01 AM |
Variable variable name | Congshi Wang | Q&A | 4 | 08-03-2010 08:01 AM |
Global variable as experiment variable | Matthias Hofmann | Q&A | 3 | 09-08-2009 09:42 AM |
Variable Operator | Michael Hartlieb | Q&A | 2 | 07-06-2009 03:53 AM |