question

WillRS avatar image
0 Likes"
WillRS asked João Dias answered

Write to a Global Table in date format

I am developing a model in which I need to track the date and time of entry and exit of parts in the system, to schedule production in 1 week (7 days).

I created a Global Table that records this information ("APONTAMENTO" Table).

I have two problems:

The first and most important is to convert the date columns ("DateEnter" and "DateOut") to the date format, since it is presented in a number format, which I do not know what it means.

I also cannot understand why for some items the "DateEnter" column presents the value 0 (zero).

The second problem is that I would like to know in the table which object of my model the item is in. The finished items will be in the "Out" queue, ok! But I would like to know where the other parts are. Is it possible to do this tracking using the GlobalTable or is there another more appropriate method?

Thanks for your help!

Tracking Process Time.fsm

FlexSim 18.2.3
global tablesimulation date
5 |100000

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

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered

The datetime number is the amount of seconds since 01.01.1601 (similar to how Excel stores a date as the number of days since 1900). Use "Model.dateTime.toString()" to write the date as text. If not specifying a format the Windows default will be used. See the documentation links below for more information about the format.

https://docs.flexsim.com/en/19.0/Reference/CodingInFlexSim/FlexScriptAPIReference/Data/DateTime.html#Method-toString

The EnterDate is only added to the table when an item enters the "Orcamento" processor. Items that get send to "FilaCorteDestaque" directly thus keep a 0 in those columns. You can store a pointer to the item in the table. It will also display the current parent object.

1732805662518.png

1732805683875.png


1732805662518.png (2.0 KiB)
1732805683875.png (4.9 KiB)
5 |100000

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

João Dias avatar image
0 Likes"
João Dias answered

Hello, the model returns the date in total current minutes of the model, to change the format you need to use some formulas such as Model.dateTime.toString(“%x”), which returns dd/mm/yyyy, other ways of collecting dates can be consulted at the link:

https://docs.flexsim.com/en/24.0/Reference/CodingInFlexSim/FlexScriptAPIReference/Data/DateTime.html

Adding the object in which the item is located, using 3D itself, by changing the type of value in the trigger included in the table can already solve the problem:

1733153290592.png



1733153290592.png (3.0 KiB)
5 |100000

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