ATTENTION

This 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

Go Back   FlexSim Community Forum > FlexSim Software > Tips and Tricks
Downloads

Tips and Tricks Share helpful modeling ideas

  #1  
Old 08-24-2007
AlanZhang's Avatar
AlanZhang AlanZhang is offline
Flexsim Super Moderator
 
Join Date: Aug 2007
Location: CA
Posts: 289
Downloads: 64
Uploads: 0
Thanks: 88
Thanked 91 Times in 47 Posts
Rep Power: 225
AlanZhang is a jewel in the roughAlanZhang is a jewel in the roughAlanZhang is a jewel in the rough
Default Create tables on the fly

I did not find a Flexsim command to create a Global table on the fly. I write a user command to accomplish this. Here is the command:

createGlobalTable(string tableName,num row, num col, num dataType, num reset)

PARAMETERS:
tableName - table name
row - number of rows
col - number of columns
dataType - data type of the table, see settablesize()
reset - 1, clear on rest; 0, no clear on reset

EXAMPLE:
createGlobalTable("mytable",2,4,1,1)

CODE:
Code:
string tableName = parstr(1);
int row = parval(2);
int col = parval(3);
int dataType = parval(4);
int reset = parval(5);
pt("createTable ");pt(tableName);pt("\t");pd(row);pt("\t");pd(col);pt("\t");pd(dataType);pt("\t");pd(reset);pr();
if(content(reftable(tableName))!=0){
    pt(tableName);pt(" already exists!");pr();
}else{
    createinstance(
      node("/GlobalTable",library()),
      node("/Tools/GlobalTables",model())
    );
    setnodename(last(node("/Tools/GlobalTables",model())),tableName);
    settablesize(tableName,row,col,dataType,0);
    setvarnum(last(node("/Tools/GlobalTables",model())),"initonreset",reset);
    updatetoolsmenu();        // add the table into Tools menu
}



All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.