Erratic date related error

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Erratic date related error

Postby Morley » Fri Jan 21, 2005 6:33 pm

I'm assuming for now that the following is due to some coding error or mine, not a Servoy bug. (I'm working in 2.2b3.) After all, I'm just starting into using date fields. They're tricky in FMP and in SQL even more so.

I've not yet found a comprehensive tutorial on the subject (would be an excellent idea) and references to date related matters are scattered and not indexed in the docs. Doing searches in ServoyTalk produces way too many hits to be useful.

I have a datetime field "calldate" where users can identify the next time a client should be called. That field has the following onFocusLost method attached to prevent users from scheduling a call in the past.

About 95% of the time or more this routine works perfectly. However, erratically I get an error message saying that "calldate" is not defined.

In this particular instance I had just come back out of Design mode, had re-established the globals and clicked in a blank calldate field. I've done this many times before without error, but this time I get the error message.

A few days ago I added a saveData() instruction right at the top of this routine to prevent exactly this error occurring. Cut down the incidence of this error way back, but obviously hasn't eliminated it.

Can anyone spot the coding error?
Code: Select all
controller.saveData();
if ( calldate )
{
   var d1 = new Date(calldate);
   var d2 = new Date();
   var diff = plugins.it2be_tools.dateDifference(d1, d2, 5);

   if ( diff < 0 )
   {
      // application.output('callsUtility.exitCallDate calldate = ' + calldate);
      calldate = null;
      controller.saveData();
      var title = i18n.getI18NMessage('7office.dlg.error');
      var msg = i18n.getI18NMessage('7office.dlg.cr.nextcallerror');
      var btn = plugins.dialogs.showQuestionDialog(title, msg);
      // 'You cannot schedule a "next call" to happen in the past.'
      calldate = application.showCalendar();
   }
}
Morley Chalmers
7Office Inc.
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Postby bcusick » Fri Jan 21, 2005 7:53 pm

Morley,

When you get an error in the user interface - if you open the log.txt file - it will give the exact java error. Perhaps that can help.
Bob Cusick
bcusick
 
Posts: 1255
Joined: Wed Apr 23, 2003 11:27 pm
Location: Thousand Oaks, CA USA

Postby Morley » Fri Jan 21, 2005 8:45 pm

bcusick wrote:When you get an error in the user interface - if you open the log.txt file - it will give the exact java error. Perhaps that can help.
I have a very mixed bag of skills. Some things I'm extremely green with (and I know it) and with others I'm reasonably capable. I've never before opened the .log.txt file (after six months now at 24Mb). Unclear how to utilize or interpret this tool.

Here's the last several entries. No idea when they were added or what they mean. No idea where or how to look for answers.
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Morley Chalmers
7Office Inc.
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Postby bcusick » Fri Jan 21, 2005 8:54 pm

Morley - the .log.txt file is 24MB???? Ouch. That file is re-created EVERY TIME you launch Servoy!

That's a LOT of errors!
Bob Cusick
bcusick
 
Posts: 1255
Joined: Wed Apr 23, 2003 11:27 pm
Location: Thousand Oaks, CA USA

Postby grahamg » Fri Jan 21, 2005 9:27 pm

Hi Morley

May not be a bug in your solution.

I also sometimes get same error message - but only when developing - so had put it down to jumping around between editor, designer and running the program. Usually find that going back to solution log-in page 'untangles' the problem - and have not encountered error when testing with Servoy Client.

I also export solutions and re-start Servoy every couple of hours as can't go longer than that without a coffee :) Probably 'belt & braces' but keeps me happy.

Regards

GrahamG
grahamg
 
Posts: 752
Joined: Fri Oct 03, 2003 3:15 pm
Location: Midlands UK

Postby Morley » Fri Jan 21, 2005 9:42 pm

grahamg wrote:May not be a bug in your solution.

I also sometimes get same error message - but only when developing - so had put it down to jumping around between editor, designer and running the program. Usually find that going back to solution log-in page 'untangles' the problem - and have not encountered error when testing with Servoy Client.

I also export solutions and re-start Servoy every couple of hours as can't go longer than that without a coffee :) Probably 'belt & braces' but keeps me happy.
Not in this case. Closed the solution and then re-opened it. Without switching to Design mode I employed the same steps. Error now appears consistently. I think there's an error in my logic or a Servoy bug, not sure which.

Besides looking for answers to this problem, I'd also like to be enlightened on utilizing the log file (what situations is it good for, how to interpret what it says). Seems extremely cryptic.

Kind regards,
Morley Chalmers
7Office Inc.
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Postby bcusick » Sat Jan 22, 2005 2:44 am

The log file is a java dump whenever an error occurs. It's really meant for Servoy personnel troubleshooting.
Bob Cusick
bcusick
 
Posts: 1255
Joined: Wed Apr 23, 2003 11:27 pm
Location: Thousand Oaks, CA USA

Postby Morley » Sat Jan 22, 2005 5:40 pm

The log file appears to be a distraction. I'm not one inch closer to a resolution of the original problem. Why am I getting this error and what can I do to resolve it?

Anyone have any ideas?
Morley Chalmers
7Office Inc.
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Postby maarten » Sun Jan 23, 2005 11:14 am

Hi Morley,

I don''t think there's anything wrong with your script.
Might be the onFocusLost event.
It's probably being triggered the moment you click to open the Calendar.
(calendar dialog receives focus> script onFocuslost calldate get's triggered too soon)
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands

Postby Morley » Sun Jan 23, 2005 5:34 pm

maarten wrote:I don''t think there's anything wrong with your script.
Might be the onFocusLost event.
It's probably being triggered the moment you click to open the Calendar.
(calendar dialog receives focus> script onFocuslost calldate get's triggered too soon)
One possibility. Certainly when I had "application.outputs" during the development phase I was seeing the method triggered two or three times.

I need to prevent clutzy end users from scheduling a "call next" to some date in the past. If not a onFocusLost event, what do you recommend?
Morley Chalmers
7Office Inc.
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Postby Morley » Sun Jan 23, 2005 5:46 pm

Changing the method from onFocusLost to onDataChange resolves the problem. Thanks.
Morley Chalmers
7Office Inc.
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 15 guests