problem creating relations

Hello, since a few days I am having problems creating new relations, I think, especially if only globals are envolved on the left side. The relations is visible and does work, but when using in a method I get an error telling me that the relation is undefined:

at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:580)
at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:540)
at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1102)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2003)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at com.servoy.j2db.develop.debugger.n.a(Unknown Source)
at com.servoy.j2db.develop.debugger.n.executeFunction(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel$b.a(Unknown Source)
at com.servoy.j2db.dataui.DataComboBox.for(Unknown Source)
at com.servoy.j2db.dataui.DataComboBox.notifyLastNewValueWasChange(Unknown Source)
at com.servoy.j2db.dataprocessing.an.commitEdit(Unknown Source)
at com.servoy.j2db.dataui.w.itemStateChanged(Unknown Source)
at com.servoy.j2db.dataui.DataComboBox.itemStateChanged(Unknown Source)
at javax.swing.JComboBox.fireItemStateChanged(Unknown Source)
at javax.swing.JComboBox.selectedItemChanged(Unknown Source)
at javax.swing.JComboBox.contentsChanged(Unknown Source)
at javax.swing.AbstractListModel.fireContentsChanged(Unknown Source)
at com.servoy.j2db.util.w.setSelectedItem(Unknown Source)
at javax.swing.JComboBox.setSelectedItem(Unknown Source)
at javax.swing.JComboBox.setSelectedIndex(Unknown Source)
at javax.swing.plaf.basic.BasicComboPopup$ListMouseHandler.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.plaf.basic.BasicComboPopup$2.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
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)

Servoy 2.1 RC 2

found the problem: I was using a relation with 2 globals on the left side. If you try to access a relation like that from a form where the underlaying table has NO records, then you have that problem.

Hi Patrick,

Here’s a TIP - check for the existence of the relationship being valid before trying to access it. For example:

if(relation)
{
relation.field = value;
}

Hope this helps,

Bob Cusick

I usually do that - but here I was sure the relation existed (because I knew the data in the globals).

I think this is an issue that could be fixed, maybe. Servoy realizes very well, if a relation is based on globals so it shouldn’t really matter from what form this relation is accessed and if the table underneath has data or not.

there was a bug in accessing global relations through javascript. This is fixed in 2.1RC3

Right now I have two problems with this:

  1. the left side of a relation is a global and the table that relation was created on might not have a foundset (better: no records) because it might never have been shown

  2. if the such a relation is accessed from a global method you can’t even heal the problem by going to that form by hand and find all records first. such a relation can’t simply be used.

I hope those issues are the problems you talked about :wink:

At least problem 2 remains in RC3: if you use a relation with a global on the left side in a global methode, it returns “relation undefined”. It doesn’t do that in a regular form method. This is an annoying problem…

that last one is now also fixed in 2.1RC4