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 02-19-2008
Lolke Koopmans's Avatar
Lolke Koopmans Lolke Koopmans is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Posts: 42
Downloads: 21
Uploads: 0
Thanks: 24
Thanked 14 Times in 10 Posts
Rep Power: 163
Lolke Koopmans is on a distinguished road
Default dbimporttable: importing date

I use an ACCESS database to import my input-data into Flexsim.
In 1 of the columns I have a date (i.e. 2007-10-12). When I import the table using dbimporttable, the only number I get is "2007".
Does anyone know how to import a date properly?


Thanks,
Lolke
  #2  
Old 02-19-2008
Jeff Nordgren's Avatar
Jeff Nordgren Jeff Nordgren is offline
Technical Support Manager
 
Join Date: Jul 2007
Location: Orem, UT
Posts: 65
Downloads: 79
Uploads: 0
Thanks: 40
Thanked 21 Times in 17 Posts
Rep Power: 233
Jeff Nordgren is just really niceJeff Nordgren is just really niceJeff Nordgren is just really niceJeff Nordgren is just really nice
Default

Lolke,

To the best of my knowledge, Access is probably defining that field as a DATE type? This may be why you're getting just the year. If it were defined as a string field (in Flexsim), I believe you would get 2007-2-19 00:00:00. Access doesn't seem to be as kind as Excel when it comes to dates.
__________________
Jeff
Flexsim Support
  #3  
Old 02-20-2008
Lolke Koopmans's Avatar
Lolke Koopmans Lolke Koopmans is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Posts: 42
Downloads: 21
Uploads: 0
Thanks: 24
Thanked 14 Times in 10 Posts
Rep Power: 163
Lolke Koopmans is on a distinguished road
Default

That is correct, Jeff.
When I look at the current database table in Flexsim, that is what I see (2007-12-10 00:00:00). But when I try to read this with dbimporttable or dbgettablenum I get "2007". I am looking for a way to understand the date correctly in Flexsim. Can I translate the string?
Another option is to use a numeric field in access. But it is set automatically to a date-field. So then I need some query or macro to change the field-type...?
  #4  
Old 02-20-2008
Jeff Nordgren's Avatar
Jeff Nordgren Jeff Nordgren is offline
Technical Support Manager
 
Join Date: Jul 2007
Location: Orem, UT
Posts: 65
Downloads: 79
Uploads: 0
Thanks: 40
Thanked 21 Times in 17 Posts
Rep Power: 233
Jeff Nordgren is just really niceJeff Nordgren is just really niceJeff Nordgren is just really niceJeff Nordgren is just really nice
Default

Flexsim can't import a date type field. Only string and number fields. You may have to do some kind of conversion from that date field into an additional field that is either a number or string field and then use that field to import.
__________________
Jeff
Flexsim Support
  #5  
Old 02-20-2008
Lars-Olof Leven Lars-Olof Leven is offline
Flexsim Distributor
 
Join Date: Aug 2007
Location: Sweden, Borlnge
Posts: 312
Downloads: 278
Uploads: 2
Thanks: 300
Thanked 256 Times in 139 Posts
Rep Power: 330
Lars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to behold
Default

Hi Lolke,

Change the type of the date column in Acsess to String and try the import again.
Depending on how Flexsim decide if the imported value should be treated as text or as a number, this solution may work. If Flexsim read the type from Access then it should work but if Flexsim looks at the first character to decide type then this will not work.

Jeff, how do Flexsim decide to import as a string or as a number? Is Flexsim getting the type from Access?

Lars-Olof
  #6  
Old 02-20-2008
AJ Bobo's Avatar
AJ Bobo AJ Bobo is offline
Flexsim Senior Developer
 
Join Date: Jul 2007
Posts: 108
Downloads: 8
Uploads: 0
Thanks: 23
Thanked 89 Times in 41 Posts
Rep Power: 221
AJ Bobo is a jewel in the roughAJ Bobo is a jewel in the roughAJ Bobo is a jewel in the roughAJ Bobo is a jewel in the rough
Default How dbimporttable() decides between string and number formats

The dbimporttable() command decides whether to import the data as a string or a number based on the data type of the table where the data is going to be placed. If a cell in the table is set as string data, then the data for that cell will be read from the database as a string. If it is set as number data, then the data will be read as a number.
  #7  
Old 02-21-2008
Lars-Olof Leven Lars-Olof Leven is offline
Flexsim Distributor
 
Join Date: Aug 2007
Location: Sweden, Borlnge
Posts: 312
Downloads: 278
Uploads: 2
Thanks: 300
Thanked 256 Times in 139 Posts
Rep Power: 330
Lars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to behold
Default

Thanks Aj for the answer.

I hope this help Lolke also.

Lars-Olof
  #8  
Old 02-22-2008
Lolke Koopmans's Avatar
Lolke Koopmans Lolke Koopmans is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Posts: 42
Downloads: 21
Uploads: 0
Thanks: 24
Thanked 14 Times in 10 Posts
Rep Power: 163
Lolke Koopmans is on a distinguished road
Default

Thanks for the feedback.
What I will do, is make the column in the Flexsim-table string-type. Now at least I get the date as a string. Then I convert this using stringcopy and stringtonum.


Thread Thread Starter Forum Replies Last Post
How to use the actual date/time data in Arrival Schedule Mode of Source syseo Q&A 0 10-12-2007 08:22 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.