intermittend issue with events, foundsets and selectedRecord

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 :

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

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 = '*';
	}
}

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?

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,

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!

please try 5.2.3 there are some changes in this area.

Hi,

after installing 5.2.4 none of the issues occurred any more.

Thanks for the fixes.

Regards,