question

Przemyslaw Pasich avatar image
1 Like"
Przemyslaw Pasich asked Przemyslaw Pasich edited

Relative pathing vs filebrowse

I have observed a (potentially buggy) behavior where commands like exporttable(), rundocument() will consider as the starting position for relative paths not modeldir(), but rather the folder of the last successfully indicated file through filebrowse().

My question is: how can I programatically "correct" the starting position for relative paths to be modeldir() after using filebrowse()?


Edit:
There are situations in which I have no other option than to rely on relative pathing, like the following: I have an .exe which is hard-coded to generate an output file in the same location where it is called from (find attached a dummy .exe that generates a .json with the current timestamp). If you run it directly from windows explorer, it'll drop the output file in the same folder. However, if you run it using rundocument(), the location of the output file will depend on the last path indicated through filebrowse(). And I need to have the output of the .exe remain in the same folder where that .exe is.

I am attaching a sample model that exemplifies the problematic behavior.

Relative pathing affected by filebrowse.fsm

generate_timestamp.7z

FlexSim 24.1.0
pathsexporttablefilebrowse
5 |100000

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

1 Answer

zacharyh avatar image
0 Likes"
zacharyh answered Przemyslaw Pasich edited

You should be able to add "modeldir()" within the exporttable() parameters.

Example: exporttable(Table("GlobalTable1"), modeldir() + "test_export_" + string.fromNum(realtime(1)) + ".csv");

· 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.

Przemyslaw Pasich avatar image Przemyslaw Pasich commented ·

Thanks for the suggestion - using an absolute path solves the issue for exporttable(), but it doesn't really work in my context. I used exporttable() in the sample model because it's the easiest to demonstrate the problematic behavior. However, in my context I am using rundocument() to launch an .exe that is internally hard-coded to work with relative paths - please see the edit to the original post.

0 Likes 0 ·