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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
|||
|
|||
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
|
||||
|
||||
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.
|
#8
|
||||
|
||||
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 |