Page 1 of 1

Intermittent error

Posted: Tue May 28, 2013 3:04 pm
by Terryfic
Hi All

I am getting the following error message when running my application:

_executing at 2:21:46 PM
Type_Operators +: error in left operand
Object_Slidercode
Line_put the value of qnum+1 into nxtnum
Hint_mouseenter

qnum and nxtnum are both declared as global variables at the top of script (before any events). The script is on a button and the behaviour is shared by several custom controls.

The application seems to run ok, but every now and then it throws up the above error. I can't see anything wrong with the logic of the statement - unless I'm being very stupid?

Any thoughts?

Regards

Terry

Re: Intermittent error

Posted: Tue May 28, 2013 3:56 pm
by dunbarx
Hi.

Can you throw in a test line right before the problem line to check if both qNum and nxtNum are in fact numbers? Sometimes errant characters worm their way into the mix. For example, if numeric entry by a user in a field is not carefully vetted, it is not uncommon for the user to type, say, a return after entry, and if the script simply takes the contents of the entry field, it will take that return along with the digits. This will cause heartache to the engine.

Craig Newman

Re: Intermittent error

Posted: Tue May 28, 2013 5:26 pm
by Terryfic
Hi Craig

I've tried the test and, for some reason, it is indeed showing as "not a number" when the mouse leaves the main group (although not every time). This may be because the variable qnum is derived (using chunk character referencing) from the name of a group that has non-numerical characters (e.g. group "BSQ2" is evaluated to 2 by this routine). I've tried putting the number in a separate variable and have even tried renaming the groups as just 1, 2, 3, etc. and placing the short name into the qnum variable, but I am still getting the intermittent error. It is a very complex stack (that allows the user to create a graph by dragging sliders) but I can't see any reason why it would evaluate qnum to anything but a number.

I've tried saving it as a standalone application and the error seems to disappear - the whole thing works fine and appears problem free.

Could I just ignore this error?

Regards

Terry

Re: Intermittent error

Posted: Tue May 28, 2013 7:33 pm
by dunbarx
I would not until you have nailed down the culprit.

When you do find, in the IDE, that one of the variable is not a number, what is it? In other words, what is the offending character? You will want to grab that variable and examine each char in it. If it looks like "123" but has a length of 4, you know what to look for, and probably what caused it. That sort of thing.

You might also try validating your data. If you do not do it at entry time (the best time), you can do it with something silly like:

put goodNumber(qNum) into qNum

function goodNumber var
repeat for each char tChar in var
if tChar is an integer then put tChar after temp
end repeat
return temp
end goodNumber

Craig Newman

Re: Intermittent error

Posted: Wed May 29, 2013 11:19 am
by Terryfic
Hi Craig

Managed to solve the problem by creating label fields within the group that have numbers in them and referring directly to these values. So far, 30 minutes without an error message, so fingers crossed. I think it was to do with carving up the group name to get the number but I don't suppose I will ever know for sure.

Thanks (again) for you help. At this rate, you and Simon will have done more work on this project than me. :) ...and the bad news is that it will probably take about a year to finish.

Regards

Terry