intermittend issue with events, foundsets and selectedRecord

Questions, tips and tricks and techniques for scripting in Servoy

intermittend issue with events, foundsets and selectedRecord

Postby Hans Nieuwenhuis » Wed Nov 17, 2010 7:20 pm

Hi,

We regular have problems like the ones below.
It happens about 3 times a week with different users.
B.t.w. the code that triggers the problem is executed hundreds of times a day for each user without problems

It looks like sometimes :

- a foundset exists, has records but there is no selected record (example 1)

- the onDataChange event does have an elementname (field) but no formname ( example 2)
As I understood from Sanneke and Johan a foundset always has a selected record, unless
it is empty.

Has anyone seen simular problems ??
I'll also create a case for this.

B.t.w. : I've put the line number on which the error is reported as comment at the end of the line !!

example 1 :
Code: Select all
Error 1:
========

ssa noSelectedrec= JSEvent(type = dataChange, source = com.servoy.j2db.smart.scripting.TwoNativeJavaObject@19724b7, formName = bvko_navInkorderspecregelsPrim_lst, elementName = inkorsrgl_prodart_nr, timestamp = Mon Nov 15 14:25:42 CET 2010,modifiers = 0,x =0,y = 0,data = null)
IBISMain INFO 2010-11-15 14:25:42.735: ssa fs_size= db:/berp2/inkorderspecregels
IBISMain INFO 2010-11-15 14:25:42.735: ssa fs_size= 4
IBISMain INFO 2010-11-15 14:25:42.735: ssa fs_count= 4
IBISMain ERROR 2010-11-15 14:25:42.767: In error Trap
IBISMain ERROR 2010-11-15 14:25:42.767: Exception Object: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "bcom_inkorderspecregels_to_verkorderregels$verkor_id" from  (doSetSignalArt#587)
IBISMain ERROR 2010-11-15 14:25:42.767: MSG: TypeError: Cannot read property "bcom_inkorderspecregels_to_verkorderregels$verkor_id" from  (doSetSignalArt#587)
IBISMain ERROR 2010-11-15 14:25:45.857: Other Error: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "bcom_inkorderspecregels_to_verkorderregels$verkor_id" from  (doSetSignalArt#587)



code 1:
=======

function doSetSignalArt(_old, _new, _event, _inpForm)
{

   var _foundset;
   
   if(_event && !_event.getFormName()){
      plugins.Log.info('ssa noEventForm= ' + _event)      
   }
   else if(!_event && !_inpForm) {
      plugins.Log.info('ssa noEventnoForm= ')
   }   

   //get foundset
   if(_event)
      _foundset = forms[_event.getFormName()].foundset;
   else
      _foundset = forms[_inpForm].foundset;
      
   if(!_foundset.getSelectedRecord()){
      plugins.Log.info('ssa noSelectedrec= ' + _event)
      plugins.Log.info('ssa fs_size= ' + _foundset.getDataSource())
      plugins.Log.info('ssa fs_size= ' + _foundset.getSize())
      plugins.Log.info('ssa fs_count= ' + databaseManager.getFoundSetCount(_foundset))
   }      

   if(databaseManager.hasRecords(_foundset.getSelectedRecord().bcom_inkorderspecregels_to_verkorderregels$verkor_id))  //line 587
   {
      _foundset.getSelectedRecord().bcom_inkorderspecregels_to_verkorderregels$verkor_id.verkor_spec_edited = '*';
   }
}


example 2

Code: Select all
error 2:
========

ssa noEventForm= JSEvent(type = dataChange, source = com.servoy.j2db.smart.scripting.TwoNativeJavaObject@136eff6, formName = null, elementName = inkospcrgl_vk_prijs, timestamp = Wed Nov 17 11:06:05 CET 2010,modifiers = 0,x =0,y = 0,data = null)
IBISMain ERROR 2010-11-17 11:06:05.186: In error Trap
IBISMain ERROR 2010-11-17 11:06:05.186: Exception Object: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "foundset" from undefined (doSetSignalArt#382)
IBISMain ERROR 2010-11-17 11:06:05.186: MSG: TypeError: Cannot read property "foundset" from undefined (doSetSignalArt#382)
IBISMain ERROR 2010-11-17 11:08:34.127: Other Error: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "foundset" from undefined (doSetSignalArt#382)




code 2 :
========

function doSetSignalArt(_old, _new, _event, _inpForm)
{

   var _foundset;
   if(_event && !_event.getFormName()){
      plugins.Log.info('ssa noEventForm= ' + _event)      
   }
   else if(!_event && !_inpForm) {
      plugins.Log.info('ssa noEventnoForm= ')
   }

   //get foundset
   if(_event)
      _foundset = forms[_event.getFormName()].foundset;  //line 382
   else
      _foundset = forms[_inpForm].foundset;
      
   if(!_foundset.getSelectedRecord()){
      plugins.Log.info('ssa noSelectedrec= ' + _event)   
      plugins.Log.info('ssa fs_size= ' + _foundset.getDataSource())
      plugins.Log.info('ssa fs_size= ' + _foundset.getSize())
      plugins.Log.info('ssa fs_count= ' + databaseManager.getFoundSetCount(_foundset))
   }
      
   if(databaseManager.hasRecords(_foundset.getSelectedRecord().bcom_inkoopspecregels_to_offerteregels$offergl))
   {
      _foundset.getSelectedRecord().bcom_inkoopspecregels_to_offerteregels$offergl.offergl_spec_edited = '*';
   }
}
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands

Re: intermittend issue with events, foundsets and selectedRecord

Postby mboegem » Wed Nov 17, 2010 10:28 pm

Hi Hans,

we've had some strange issues when loading a dataset onto a form.
The foundset in memory showed the correct result, but the controller didn't show any records.
This had something to do with tablefilters and - as a result of this - some additional check which Servoy did in the background in order to show the correct records based on the filters.
This has been fixed in 5.2.2.

Without the tablefilters we didn't have any problem at all. Do you use tablefilters and - if so - did you try to run your solution in 5.2.2. already?
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1750
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: intermittend issue with events, foundsets and selectedRecord

Postby Hans Nieuwenhuis » Thu Nov 18, 2010 8:29 am

Thanks Marc,

We already use 5.2.2. We use no tablefilters. We do use Foundsetfilters, but I don't think
they are causing this.

Regards,
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands

Re: intermittend issue with events, foundsets and selectedRecord

Postby mboegem » Thu Nov 18, 2010 10:25 am

Hi Hans,

basically, foundsetfilters should have caused the exact same effect in 5.2.1, but since you're already using 5.2.2... I'm afraid I can't be of any more help to you..

Good luck!
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1750
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: intermittend issue with events, foundsets and selectedRecord

Postby jcompagner » Fri Nov 26, 2010 6:36 pm

please try 5.2.3 there are some changes in this area.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: intermittend issue with events, foundsets and selectedRe

Postby Hans Nieuwenhuis » Tue Jan 25, 2011 5:10 pm

Hi,

after installing 5.2.4 none of the issues occurred any more.

Thanks for the fixes.

Regards,
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands


Return to Methods

Who is online

Users browsing this forum: No registered users and 4 guests