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
|
|||
|
|||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
|||
|
|||
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.
|
The Following User Says Thank You to Kris Geisberger For This Useful Post: | ||
Phil BoBo (04-05-2011) |
#8
|
||||
|
||||
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
|
|||
|
|||
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. |
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 |