Export String Data To File


Recommended Posts

I am trying to write strAlert data to an export file but have been only semi successful.

In my StartUp I set  global string dispmsg = strAlert and use this in a table component. This seems to work well but if the operator does not note the messages they are gone when the application is closed. I have been able to append dispmsg to my export file with the following code in my message sequence but I get between 50 and 10k lines for each mesage. I want one line with time stamp in my export file for each displayed message.


     global string dispmsg = strAlert
     private handle = file.open(Export.Field_Data.FileName.Snapshot,0,1,1,1)




Link to comment
Share on other sites

You need [0] after strAlert since strAlert holds up to the last 100 error messages. Also, you have a loop without any delay.  This is going to use / waste a lot of CPU power.  Consider adding a delay(0.05) before the endwhile


That all said, I recommend considering the OnAlert() system event described in 5.28.  This is called whenever an alert is generated.  You can then put your logging code in there.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.