question

Tee Hiett avatar image
0 Likes"
Tee Hiett asked Andrew O commented

Import scheduled time as label on a patient

In a Posting a few years ago, @Matthew Gillespie wrote:

I think the best thing to do in this case would be to add another column in Excel and duplicate the first column data in this row. That way when you import the file you get another Label column in the Date Time Source's table.

I am having trouble doing this. A little help would be greatly appreciated.

FlexSim 21.2.4
excel importingscheduled arrival
· 2
5 |100000

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

Tee Hiett avatar image Tee Hiett commented ·

Thanks for your help. That first process seems to work. The first patient.ArrTime shows 13:00:00.

Now, how do I compute the patient.ArrTime - patient.CreationTime in the attached model?

Scenario 2 - Experiments 0516 A - Copy.fsm.jpg


0 Likes 0 ·
Andrew O avatar image Andrew O commented ·

Hi @Tee Hiett, 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
0 Likes"
Felix Möhlmann answered Felix Möhlmann commented

What step are you having trouble with?

For the first solution in the linked post, you would add a string label to the source table and copy the first column over.

1663568417832.png

You can also use the second approach Matthew posted as a later comment, which is to read the time from the table view of the schedule. In addition to that reply, you can then use the "DateTime" constructor to convert the numerical value into a time string that contains the hours and minutes.

1663568599376.png


1663568417832.png (37.3 KiB)
1663568599376.png (15.8 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.

Felix Möhlmann avatar image Felix Möhlmann commented ·

To compute the difference between two times I would keep them as numerical values so you don't have to convert the strings back before doing the calculation.

You can use a variant of the second method above to assign the scheduled time from the table to a label by defining the value of the label in custom code. (The code below assumes that the model starts at midnight, so that the value in the table is equal to the model time at which the patient is scheduled. It then also adds to the time depending on the cycle count with the assumption that a daily repeat might be added later.)

1663742188176.png

Then you can just read the current time with "Model.time" and compare the two numbers directly.

1663742007435.png

1663742032933.png1663742326721.png(Values from a second day with daily repeat set)

If you want the values in the string format, you can convert them afterwards like you do with when reading the time in your attached model.

0 Likes 0 ·
1663742007435.png (9.5 KiB)
1663742032933.png (2.6 KiB)
1663742188176.png (55.4 KiB)
1663742326721.png (2.4 KiB)