question

Óscar Manuel CMN avatar image
0 Likes"
Óscar Manuel CMN asked Kavika F commented

Write dates

Hello,
I have problems with a model and I hope that you can help me.

Trough a dashboard, you must enter the date you want to take out the order as seen in the following image:

1651314618561.png


What you enters is put into a global table called "Fechas"

1651314654575.png


The intentions is that in "Fecha Inicio" put the date on which it would have to start. That is, the indicated date - the processing time.

I made this code in a process flow bur I don´t know how exactly works the library "datetime"
1651314757651.png


The "LastExit" label is a number label that has the sink and that is saving the time each time an order enters it.

How can I fix it?


FlexSim 21.0.10
date time
1651314618561.png (2.7 KiB)
1651314654575.png (2.6 KiB)
1651314757651.png (19.5 KiB)
· 1
5 |100000

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

Kavika F avatar image Kavika F ♦ commented ·

Hi @Óscar Manuel CMN, was Felix Möhlmann's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered

Your code looks correct and I don't see any description of what exactly the problem is in your post, so here is some general advice.

If you are having trouble with a particular FlexScript command or class, you can look up the reference in the manual and see if that helps you to fix the issue. Below I will link to the page about the DateTime class.

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

When converting a string to a DateTime, make sure that either the date string is given in the windows default format or specify the format as a second parameter, so the function can correctly interpret your string.

In your case this would be:

DiaElegido = DateTime(TableFechas[1][2], "%d/%m/%Y - %H:%m")

You might also want to write the resulting "DiaInicio" to the table as a string, instead of the numerical DateTime value

TableFechas[1][1] = DiaInicio.toString();

I hope this helps you with your problem. If not, please provide some more information about what exactly is going wrong in your model. And if possible attach the model; diagnosing errors is much easier that way. You can make the private if necessary.

5 |100000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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