question

xuan-123 avatar image
0 Likes"
xuan-123 asked Julie Weller commented

How to use Flexscript (Python) to create the data into global table

I referred this site, building the following model, getting the error https://answers.flexsim.com/questions/123230/how-to-use-flexscript-python-to-create-the-data-in.html

1690515935747.png

how do i fix the error

example project.fsm

TestScript.py

FlexSim 23.0.8
python connector
1690515935747.png (22.7 KiB)
testscript.py (160 B)
example-project.fsm (25.8 KiB)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Arun Kr avatar image
0 Likes"
Arun Kr answered Arun Kr commented

User command is created as "generateDate" and in the script it is called as "generateData". Make it same it will work.

  1. Array data = generateDate(Table("MyTable").numRows, Table("MyTable").numCols);
  2. for (int i = 1; i < Table("MyTable").numRows+1; i++) {
  3. Array row = data[i];
  4. for (int j = 1; j < Table("MyTable").numCols+1; j++) {
  5. int value = row[j];
  6. Table("MyTable")[i][j] = value;
  7. }
  8. }
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.