Checking success of export to CSV

Checking success of export to CSV

jeremy_r
Not applicable
13 Views
3 Replies
Message 1 of 4

Checking success of export to CSV

jeremy_r
Not applicable

[ FlexSim 18.2.0 ]

Is there a way to test if an export to CSV was successful?

We have discovered that if the user has the CSV file open when they try and overwrite it from FlexSim using the exporttable command, FlexSim continues without any kind of warning. Is there a way to validate that the export was successful? I tried returning the value of exporttable, but it is always 0 regardless of whether it succeeds or not.

Ideally, we would want to be able to check if the export failed, and display a warning message to the user if this was the case.

0 Likes
Accepted solutions (1)
14 Views
3 Replies
Replies (3)
Message 2 of 4

tanner_p
Not applicable

Could you try using the FlexScript Code Profile? Just an idea..

16275-flexsim-code-profile.png

0 Likes
Message 3 of 4

jeremy_r
Not applicable

I'm not sure how this helps. How do you use the code profile to detect if the export was successful?

0 Likes
Message 4 of 4

JordanLJohnson
Autodesk
Autodesk
Accepted solution

You can check if FlexSim has permission to write to it by using the file API in FlexSim:

int success = fileopen(fileName, "a"); // open in append mode
if (success) {
    fileclose();
} else {
    print("Could not open file ", fileName);
}
exporttable(...);

It should catch whether exporttable will be able to actually write to the file.

.


Jordan Johnson
Principal Software Engineer
>