Expand my Community achievements bar.

Ideas requested for logging script activities

Avatar

Level 3

I have a form developed in LC with considerable scripting. I need to strip out all the debugging alerts and send the form out to users but I would like to figure out some way to debug any future problems.

My thought is to somehow log script activities so that when a failing form is returned to me I can see what was going on to produce the problem.

One idea is to use a hidden listbox to record script activity - results of IF statements, FOR loops, index values, etc. I could use addItem to make a history of the last n activities and hopefully see what led to the problem.

I'd like to make the list circular, that is after n entries go back to the top and overwrite the oldest entries. Not sure how to accomplish this...

Any ideas are most welcome! Thanks!

2 Replies

Avatar

Level 3

Added a number box called RecNo as hidden

Added a listbox called LogBox as hidden along with some logic to unhide it and hide it again

I created a common function:

function LogMsg(msg) {

     LogBox.addItem(worksheet.RecNo.rawValue + msg); // add record number and message

     RecNo.rawValue++; // increment

     if (RecNo.rawValue > 20) { // size limit for listbox, pick a favorite number

          LogBox.deleteItem(0); // delete top (oldest) entry

     }

}

From places in code I want to track if there is a failure:

     Script_object.LogMsg("any message");