Hi
I am running a script that takes part numbers and does an adjustment in our database. Every now and then we either have network lag or a record lock that momentarily throws off the timing of the script and the it aborts. I started moving the part number and a count number from a column I added to the excel into notepad so I see the part number and the count it made it to knowing that no other parts would process after the script aborts.
Does anyone have any ideas or another effective way on how to know what the count of my records is when the script crashes?
Need suggestions for tracking records processed from excel
Moderators: Dorian (MJT support), JRL
Need suggestions for tracking records processed from excel
Just when you thought it was safe to go in the water........
- Marcus Tettmar
- Site Admin
- Posts: 7391
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Use a log file. Either just use the bult in logging or your own logging using e.g. WriteLn, Timestamp or Datestamp commands. Log out the date, time and record count. Then if it all stops working just look at the last line in the log file to see how far it got.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
You'll only see the "Logging" tab if you edit the script from the Macro Scheduler main menu. If you run the script outside of the main Macro Scheduler program, logging in relation to that tab has no meaning....but is there some reason why I dont see the logging tab when I am in edit mode for my script(right clicking on the file in windows explorer)?? Does that only show up when starting a new macro??
But I agree with Marcus. If your goal is to record the last part number the script accessed before crashing you need to add a line or two to your script that writes to a file data pertinent to your diagnostic desires. The logging capabilities built into Macro Scheduler will record every action for every line in the script. For what you're asking, this would be way more data than you need and would make the analysis unnecessarily difficult.
I would use a few lines like:
Code: Select all
GetDate>today
GetTime>now
WriteLn>%temp_dir%partlogfile.txt,wres,%today% - %now% - %partnumber%
- Marcus Tettmar
- Site Admin
- Posts: 7391
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
DateStamp will do all that in one line:
DateStamp>%SCRIPT_DIR%\mylog.txt,Current Part: %partnumber%
DateStamp outputs the date and time including milliseconds followed by your message (which could include a variable value) to the specified file.
DateStamp>%SCRIPT_DIR%\mylog.txt,Current Part: %partnumber%
DateStamp outputs the date and time including milliseconds followed by your message (which could include a variable value) to the specified file.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Thank you for the responses. I setup the code in my script as a sample for the datestamp:
DateStamp>c:\Temp\adjusttime.txt,Count: %field_3%
DateStamp>c:\Temp\adjusttime.txt,Current Part: %field_1%
2013-01-11:14:37:29:942 - Count: 1
2013-01-11:14:37:29:942 - Current Part: 23
2013-01-11:14:37:39:208 - Count: 2
2013-01-11:14:37:39:208 - Current Part: 612
2013-01-11:14:37:48:458 - Count: 3
2013-01-11:14:37:48:458 - Current Part: 905
2013-01-11:14:37:57:724 - Count: 4
2013-01-11:14:37:57:724 - Current Part: 2012
Can you have multiple variable values in the line somehow like this?
DateStamp>c:\Temp\adjusttime.txt,Count: %field_3%, Current Part: %field_1%
I tried this first but it didn't work and was thinking it would do this:
2013-01-11:14:37:29:942 - Count: 1 Current Part: 23
2013-01-11:14:37:39:208 - Count: 2 Current Part: 612
2013-01-11:14:37:48:458 - Count: 3 Current Part: 905
2013-01-11:14:37:57:724 - Count: 4 Current Part: 2012
So I made the 2 lines for the info as above.
Thanks
DateStamp>c:\Temp\adjusttime.txt,Count: %field_3%
DateStamp>c:\Temp\adjusttime.txt,Current Part: %field_1%
2013-01-11:14:37:29:942 - Count: 1
2013-01-11:14:37:29:942 - Current Part: 23
2013-01-11:14:37:39:208 - Count: 2
2013-01-11:14:37:39:208 - Current Part: 612
2013-01-11:14:37:48:458 - Count: 3
2013-01-11:14:37:48:458 - Current Part: 905
2013-01-11:14:37:57:724 - Count: 4
2013-01-11:14:37:57:724 - Current Part: 2012
Can you have multiple variable values in the line somehow like this?
DateStamp>c:\Temp\adjusttime.txt,Count: %field_3%, Current Part: %field_1%
I tried this first but it didn't work and was thinking it would do this:
2013-01-11:14:37:29:942 - Count: 1 Current Part: 23
2013-01-11:14:37:39:208 - Count: 2 Current Part: 612
2013-01-11:14:37:48:458 - Count: 3 Current Part: 905
2013-01-11:14:37:57:724 - Count: 4 Current Part: 2012
So I made the 2 lines for the info as above.
Thanks
Just when you thought it was safe to go in the water........
Its failing because you have an extra comma and so the DateStamp function has too many parameters. You just need to use a let> to have an extra comma in the line.Can you have multiple variable values in the line somehow like this?
DateStamp>c:\Temp\adjusttime.txt,Count: %field_3%, Current Part: %field_1%
Code: Select all
Let>PrnText=Count: %field_3%, Current Part: %field_1%
DateStamp>c:\Temp\adjusttime.txt,PrnText