Need suggestions for tracking records processed from excel

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Esabik
Pro Scripter
Posts: 52
Joined: Wed Jun 15, 2005 8:03 pm
Location: Fairfield, NJ

Need suggestions for tracking records processed from excel

Post by Esabik » Thu Jan 10, 2013 7:40 pm

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?
Just when you thought it was safe to go in the water........:evil:

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Jan 10, 2013 8:01 pm

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?

User avatar
Esabik
Pro Scripter
Posts: 52
Joined: Wed Jun 15, 2005 8:03 pm
Location: Fairfield, NJ

Post by Esabik » Thu Jan 10, 2013 9:52 pm

Well thanks for the ideas, 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?? ver 12.1.10
Just when you thought it was safe to go in the water........:evil:

User avatar
JRL
Automation Wizard
Posts: 3518
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Jan 11, 2013 4:15 am

...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??
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 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%

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Jan 11, 2013 11:16 am

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.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Esabik
Pro Scripter
Posts: 52
Joined: Wed Jun 15, 2005 8:03 pm
Location: Fairfield, NJ

Post by Esabik » Fri Jan 11, 2013 8:08 pm

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
Just when you thought it was safe to go in the water........:evil:

User avatar
JRL
Automation Wizard
Posts: 3518
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Jan 11, 2013 10:06 pm

Can you have multiple variable values in the line somehow like this?
DateStamp>c:\Temp\adjusttime.txt,Count: %field_3%, Current Part: %field_1%
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.

Code: Select all

Let>PrnText=Count: %field_3%, Current Part: %field_1%
DateStamp>c:\Temp\adjusttime.txt,PrnText

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts