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 > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 06-16-2009
Joe Allen Joe Allen is offline
Flexsim User
 
Join Date: Jul 2008
Posts: 80
Downloads: 2
Uploads: 0
Thanks: 34
Thanked 5 Times in 3 Posts
Rep Power: 151
Joe Allen is on a distinguished road
Default CSV File Created by clicking "Generate Report"

The CSV file that get's created when the "Generate Report" button is clicked for either the Summary Report or the State Report has 2 rows at the top that make linking to the CSV from MSAccess problematic. Is there a way to stop Flexsim from putting "Flexsim State Report" and "Time: ####" in the first 2 rows of the CSV?
  #2  
Old 04-03-2011
Nischith Kashyap's Avatar
Nischith Kashyap Nischith Kashyap is offline
Flexsim User
 
Join Date: Nov 2010
Location: Wollongong, Australia
Posts: 51
Downloads: 26
Uploads: 0
Thanks: 19
Thanked 0 Times in 0 Posts
Rep Power: 118
Nischith Kashyap is on a distinguished road
Default Import CSV into a Global table in Flexsim...

Hello

I have a CSV file, which i need to import into flexsim as a global table. I did try file open, and file read line in my code, but my global table has all the elements in one row as a single cell and not each element in each cell. Could some one please help me out, so that instead of all the elements falling into one cell, i could get each element into each cell. the elements can be strings or int's, i am just trying to fix the global table.

please help......
  #3  
Old 04-04-2011
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

This has most probably to do with your country settings. Is your data seperated by a comma or by a different sign. If that is the case try changing it to a comma and try reading it in again.

Btw have you tried the Excel interface for reading it in? That is quite easy.
  #4  
Old 04-04-2011
Nischith Kashyap's Avatar
Nischith Kashyap Nischith Kashyap is offline
Flexsim User
 
Join Date: Nov 2010
Location: Wollongong, Australia
Posts: 51
Downloads: 26
Uploads: 0
Thanks: 19
Thanked 0 Times in 0 Posts
Rep Power: 118
Nischith Kashyap is on a distinguished road
Default

Hi

The data is seperated by a comma, and i would like to know if any command is available to import a csv as a global table into flexsim. It is working when i import from excel, but since i cannot use excel for my project, i would only be able to use a csv flie........

Thanks....
  #5  
Old 04-04-2011
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1174
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default

Try the importtable() command.

If you were trying to write code to use fileopen() and filereadline() to import a csv file, then it would have been helpful if you had posted your code. If you are having trouble reading a csv with those commands, then the problem is in your code. It is difficult to explain what is wrong with your code without seeing it.
  #6  
Old 04-05-2011
Nischith Kashyap's Avatar
Nischith Kashyap Nischith Kashyap is offline
Flexsim User
 
Join Date: Nov 2010
Location: Wollongong, Australia
Posts: 51
Downloads: 26
Uploads: 0
Thanks: 19
Thanked 0 Times in 0 Posts
Rep Power: 118
Nischith Kashyap is on a distinguished road
Default

Hello

My code is quite simple, and it works, but it doesnt recognize the " , " and everything in one row, is placed into one cell in the global table which is the problem. I am trying to make
1,2,3 in three different columns in one row, but with my code it reads all that in one line, and puts it in one cell in the global table........
this is the code i used.


fileopen("C:/Documents and Settings/renth/Desktop/test.csv","r");
for (int t=1; t<=3;t++)
{
string text=(filereadline());
settablenum("Testing",1,1,stringtonum(text));
}
fileclose();

Please if you could help me out with my code......
Thanks
  #7  
Old 04-05-2011
Kris Geisberger Kris Geisberger is offline
Flexsim Canada, Forum Moderator
 
Join Date: Aug 2007
Location: Canada
Posts: 209
Downloads: 54
Uploads: 1
Thanks: 99
Thanked 389 Times in 133 Posts
Rep Power: 451
Kris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud of
Default code for reading csv txt into Global Table

If your data file does not quite fit the csv format (and importtable() does not work for you), then the attached model and test txt should give you some ideas.
Attached Files
File Type: txt test csv.txt (33 Bytes, 169 views)
File Type: zip code to read csv txt file into Global Table.zip (34.2 KB, 136 views)
The Following User Says Thank You to Kris Geisberger For This Useful Post:
Phil BoBo (04-05-2011)
  #8  
Old 04-05-2011
Nischith Kashyap's Avatar
Nischith Kashyap Nischith Kashyap is offline
Flexsim User
 
Join Date: Nov 2010
Location: Wollongong, Australia
Posts: 51
Downloads: 26
Uploads: 0
Thanks: 19
Thanked 0 Times in 0 Posts
Rep Power: 118
Nischith Kashyap is on a distinguished road
Default

Hello Kris...

I did open your model, you have attached, but i couldnt see any code in it.......
I was just wondering if i was searching the wrong places...
Could you please brief me what needs to be done in regards to this....
  #9  
Old 04-05-2011
Kris Geisberger Kris Geisberger is offline
Flexsim Canada, Forum Moderator
 
Join Date: Aug 2007
Location: Canada
Posts: 209
Downloads: 54
Uploads: 1
Thanks: 99
Thanked 389 Times in 133 Posts
Rep Power: 451
Kris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud of
Default

Copy/paste the attached code into a Script window and Execute it. You will first need to create a Global Table called "Testing" if you want to try the code as-is.
Note that "Option 1" in the code uses a command that was introduced in v5 called stringtoken(), but Option 0 and 2 will work in older versions.
Attached Files
File Type: txt code to read csv txt file into Global Table.txt (2.2 KB, 157 views)
The Following User Says Thank You to Kris Geisberger For This Useful Post:
Nischith Kashyap (04-05-2011)


Thread Thread Starter Forum Replies Last Post
Is it possible one object comprised of the function of "combiner" and "separetor"? Vic Li Q&A 1 08-19-2008 04:41 AM
error message "Clock overflow, running stopped" Martin Kooijman Q&A 11 04-17-2008 10:29 AM
about "no select" and "show parameter window from side bar" qin tian Gripes and Goodies 3 03-21-2008 08:10 AM
Which variable stores "Properties -> General ->Flags -> Protected" information? KelvinHo Q&A 1 03-06-2008 06:18 AM
"Getting Started" and "Tutorial" models for v4.01 Cliff King Product Announcements 0 12-10-2007 07:34 PM


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.