record becomes com.servoy.j2db.dataprocessing.ao@6efaf

Hello,

something goes wrong but I don’t see where. I have this code:

var table = some_global_relation.getRecord(1);  // I see the record nicely in the debugger

... // I do some stuff

forms[form].controller.loadAllRecords(); // my record turned into com.servoy.j2db.dataprocessing.ao@6efaf and I can't access it's properties/columns anymore

What happened to the record that table once was ? :cry:

Thanks for any help

Patrick

My colleague told me that this happens to him very often. It seems that it does not happen always when running the exact same method and less often when the debugger is turned on.

This is a very annoying problem. We use records a lot, we pass them around, use relations from a record and so forth. It is unpleasant if you cannot be sure that your record “survives” while you move along.

What you see is a toString representation from an invalid record…

It is very well possible that a record is not longer accessible when some thing is done to the foundset, we have updated the (sample)code to include:

reference is valid as long nothing else is done on foundset

hmm. This is very nasty! We touch foundsets all over the place (pass them around, load them). Can’t this be made more reliable? Is there a workaround? In my example above, all I do is

forms[form].controller.loadAllRecords();

where form is a completely different form/foundset than the one from which I retrieve my record.

Better explanation:
Record reference is valid as long nothing else is done on it’s foundset

Other foundsets are of no importance

I perfectly understood your explanation. But I dislike it very much! This is very inconsistent behaviour in my eyes that you store a reference to something in a variable and while doing something completely different, it gets lost. Is there no way this can be changed, so a record will stay a record until I put something else into that variable? Can I somehow “clone” that record so it will stay with me?

When you have tons of nested methods and use a record at some point, you can never be sure if it reaches the end of the method process. This is also almost impossible to debug.

And even worse: in my example I did not touch the foundset where I retrieved the record from. As you can see, the record came from a global relation some_global_relation and the foundset that I load using loadAllRecords is based on a completely different table.

patrick:
…store a reference to something in a variable and while doing something completely different…

Only on the foundset from which the record is a member…

patrick:
Is there no way this can be changed, so a record will stay a record until I put something else into that variable? Can I somehow “clone” that record so it will stay with me?

currently not, but you could duplicate the foundset and take/keep a record from the other not touched foundset

patrick:
When you have tons of nested methods and use a record at some point, you can never be sure if it reaches the end of the method process. This is also almost impossible to debug.

Understood, but its the current “record lifespan” definition, otherwise memory leaks can/will occur in Servoy

patrick:
And even worse: in my example I did not touch the foundset where I retrieved the record from. As you can see, the record came from a global relation some_global_relation and the foundset that I load using loadAllRecords is based on a completely different table.

You also did not change the global defining the related foundset?

You also did not change the global defining the related foundset?

No.

This is really getting a problem somehow. I just started a method that always worked nicely for the first time in RC7 and now seem to have that problem here, too. What is strange (and we have observed that many times) is that you have an 80% chance of not getting an error when the debugger is turned on. In my case, my record died here:

sysField = g_sys_tabelle_sys_feld_to_sys_fields.getRecord(1);
if (jscolumn.isRowIdentifier())
{
	rowIdentifier = 1;
	sysField.sys_fields_to_sys_tables.uid_sys_fields_pk = sysField.uid_sys_fields;
}
else
{
	rowIdentifier = null;
}
if (sysField.feld_laenge != parseInt(jscolumn.getLength()))
{
	forms.sys_tables_log.logeintragNeu(sysField.uid_sys_tables, sysField.uid_sys_fields, 2, 'column length', sysField.feld_laenge, parseInt(jscolumn.getLength()));
	sysField.feld_laenge = parseInt(jscolumn.getLength()); // Here I get the error
}

g_sys_tabelle_sys_feld_to_sys_fields is a relation with two globals on the left and forms.sys_tables_log is based on a different table.

I really hope this can be made more reliable. I don’t see where in the above code a foundset is even touched at all.

this is a bit improved now >RC7 the records shouldn’t be invalid as soon as they did now.

If this still happens with a certain case please let me know