03-19-2018 06:27 AM - edited 03-19-2018 06:30 AM
hello,
i need to create error log that save all the errors which produced by the automatic error handler ..
can any one suggest a simple method to do that ?
thank you .
03-19-2018 06:40 AM
Hi,
You can built "subvi error", and when error will occur, take the informations that you want and save it in the ASCII file (text file). Use the function : "Set file Position" to avoid overwriting of the datas.
Regards,
Fred.
Kudos are welcome!![]()
03-19-2018 07:13 AM
thank you Fred for reply,
the problem here that when i save the information in txt file i will need a method to display these information where it is difficult to do with text file .
i need to display the error code, source and message in three seperated fields which is difficult when the info are in txt file .
Regards
03-19-2018 07:31 AM
Ok, I see. In this case, You should use "CSV file". by using the function "Write Delimited Spreadsheet" You can format data of your cluster and save it.
Regards,
Fred.
Kudos are welcome!![]()
03-19-2018 08:42 AM - edited 03-19-2018 08:43 AM
what you said was exactly what i have tried, the problem was to break down the data which produced by cluster in 3 fields ..
i used ; as delimiter to be able to seperate the 3 fields from each other but the data have been sperated depending on ; and on starting new line and then the data did not make sense any more.
Regards
03-19-2018 09:05 AM
Try this code below.
You can then use csv (or text file if you want : the data will be separeted by the comma on each line. "status","code","source") and you have many fuction in the palet Programming>>String to help you for reading.
03-19-2018 09:32 AM
thank you Fred ,
as i said the problem is not when i try to save the info from the cluster in the text file .. the problem comes when we try to display these info ..
when i do have for example 100 errors how can i display every single error alone ? we must find a way to go through the text file and somehow must the programm recognize where the data of an error begin and where they finish and display these data in three seperated fields or two the code of the error and the source of it ... so when i tried to use read Delimited Spreadsheet depending on the delimiter the program sees two type of delimiter :
1- my delimiter ;
2- new line
03-19-2018 09:58 AM
Use the "for loop" if you want to read all "error" in your file and you will be able to display each error. or index your array to read an error precisely. Convert the "code" of the "error" in number (if you want).
How would you like to read ? (ex:when you push button it display the next error or when you give the number it display the corresponding error).
Kudos are welcome!![]()
03-19-2018 10:12 AM
this an example how i want to display the errors and for example the drop down list display the last 10 errors ..
03-19-2018 10:49 AM
Do you want to save date and hour (if yes, let me know) ?
One of your solution is below,
Don't forget the error handling.
Regards,
Fred.
Kudos are welcome!![]()