I have been waiting for someone else to complain, but since no one is speaking up I will. Their is a general problem in 2.2.3 that did not exist in 2.2.1 where one can use Servoy to add new rows to tables but when those tables are displayed it is as if Servoy is unaware of the data. For instance I use the below script to add rows to a table called ‘examination’ and add related rows to related tables. If I then Show the data in the last line of the code I get an error message in the onShow saying certain values are not defined. When I look in the backend database the undefined values have been stored in the backend database. If I refresh the application from the database just prior to showing the form [next to last line of code commented out] I do not get the error. This is a very big problem with 2.2.3. I am still running 2.2.1 without this issue. [I am not sure if this is related to the problem but I should not that we always let the backend database create the primary key by setting it to database identity.]
var thedate = application.getServerTimeStamp()
thedate = globals.NextDay(thedate);
var thefinaldate = utils.dateFormat(thedate,‘MM/dd/yyyy’);
var thebeginningdate = utils.dateFormat(application.getServerTimeStamp(),‘MM/dd/yyyy’);
var maxReturedRows = 5;//usefull to limit number of rows
var query = ‘SELECT examinationid’
query += ’ FROM examination’
query += " WHERE demographicsid =‘" + demographicsid + "’"
query += " AND date_created >= ‘" + thebeginningdate + "’"
query += " AND date_created < ‘" + thefinaldate + "’"
var foundset = databaseManager.getDataSetByQuery(controller.getServerName(), query,null, maxReturedRows);
var recordCount = foundset.getMaxRowIndex()
if(recordCount > 0)
{
var x = plugins.dialogs.showInputDialog(‘Warning: More than one exam this date!’, ‘Second exam this date?’)
if(x != ‘Second exam this date’)
{
return;
}
}
globals.license();
demographics_to_examination.newRecord()
demographics_to_examination.doctors_initial_phone = doctors_initial_phone
demographics_to_examination.date_created = globals.date_without_time(application.getServerTimeStamp());
controller.saveData()
var theid = demographics_to_examination.examinationid
//had problems in the past getting the billing_master made??
demographics_to_billing_master.newRecord()
demographics_to_billing_master.examinationid = theid
controller.saveData()
//be sure all parameters are recalculated.
databaseManager.recalculate(demographics_to_billing_master)
demographics_to_examination_anterior_segment.newRecord()
demographics_to_examination_anterior_segment.examinationid = theid
controller.saveData()
demographics_to_examination_eyelid.newRecord()
demographics_to_examination_eyelid.examinationid = theid
controller.saveData()
demographics_to_examination_lacrimal.newRecord()
demographics_to_examination_lacrimal.examinationid = theid
controller.saveData()
demographics_to_examination_motility.newRecord()
demographics_to_examination_motility.examinationid = theid
controller.saveData()
demographics_to_examination_nerve.newRecord()
demographics_to_examination_nerve.examinationid = theid
controller.saveData()
demographics_to_examination_optics.newRecord()
demographics_to_examination_optics.examinationid = theid
controller.saveData()
demographics_to_examination_orbit.newRecord()
demographics_to_examination_orbit.examinationid = theid
controller.saveData()
demographics_to_examination_socket.newRecord()
demographics_to_examination_socket.examinationid = theid
controller.saveData()
demographics_to_examination_vision.newRecord()
demographics_to_examination_vision.examinationid = theid
controller.saveData()
demographics_to_prescription_master.newRecord()
demographics_to_prescription_master.examinationid = theid
demographics_to_prescription_master.doctors_initial_phone = doctors_initial_phone
controller.saveData()
if(contact_to_preferences.record_locking == 1)
{
var success = databaseManager.acquireLock(demographics_to_examination,-1)
}
//determine how many examination records this patient had
var maxReturedRows = 10000;//usefull to limit number of rows
var query = ‘SELECT examinationid’
query += ’ FROM examination’
query += " WHERE demographicsid =‘" + demographicsid + "’"
var foundset = databaseManager.getDataSetByQuery(controller.getServerName(), query, null, maxReturedRows);
var count = foundset.getMaxRowIndex()
forms.examination_controller.controller.loadRecords(foundset)
forms.examination_controller.controller.setSelectedIndex(count) //globals.RefreshFromDatabase();
forms.examination_controller.controller.show()
Thanks
John McCann
Windows
Java 1.4.x
Microsoft SQL Server
Since upgrading to 2.2.3 from 2.2.1, I’m experiencing big problems with Servoy losing track of records/relationships and I’m also using SQL Server with db identity keys.
Here’s an example:
on a quote, I create a new line item, which in turn creates one child record in the ‘Miscellaneous item’ table
I do controller.saveData() on the new records and I can see that all the db-generated primary keys have been set properly
I pop up a form-in-dialog, showing a form based on ‘Miscellaneous item’ that also includes fields from its parent, the line item
I type in one of the fields from the parent line item, Servoy accepts the value and writes it to the database, but then this and all of the other values from the parent disappear from the form
No further changes can be made to the parent line item record’s fields from the child until I have switched into design mode and back. Then everything works fine for existing records, but the problem resurfaces with each new record
Will chime in as well. We have a good working example of this problem with Sybase as the backend. Database managed keys. Creating related records where the relationship has only one match works fine. Lose about 10% to 20% of records that are created via a relationship that has two matches – one of which is a global on the left side. No amount of throwing in the saveData() function at various places helps.
Let me know if you want me to send this solution over.
And I agree it seems to be related to the fact that the relationship in question uses more than one criteria, one beeing a global. But I also see that those records are indeed created, they are just not loaded into Servoy.
I am testing. I see, however, one other problem related to relations using globals.
In the messages table, reference keys are stored with a message_language NULL if created by Servoy’s i18n tools. When I try to rebuild the i18n logic by myself, I need to setup a relationship that points to those NULL values for the reference key. I have setup a relationship using two globals, one for the key and one for the language. In case of the reference value I have tried three ways:
Setting the language global to “null” as default value: the result is the String “null” in the language key column?!
Setting the language global to “null” using a method (globals.xxx = null): the result is an empty String in the language key column (not NULL!) or the value “NullV” if the record was newly created.
Not setting the language global to anything: the result is an empty String in the language key column
So the question is: how can I force a NULL value using a relation?
One of my methods that created a popup-menu now gives me this:
org.mozilla.javascript.JavaScriptException: java.lang.ClassCastException: java.lang.Object
org.mozilla.javascript.JavaScriptException: java.lang.ClassCastException: java.lang.Object
at org.mozilla.javascript.JavaScriptException.wrapException(JavaScriptException.java:71)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:381)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1254)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2031)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at com.servoy.j2db.develop.debugger.k.a(Unknown Source)
at com.servoy.j2db.develop.debugger.k.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.AbstractScriptLabel.a(Unknown Source)
at com.servoy.j2db.dataui.AbstractScriptLabel.access$5(Unknown Source)
at com.servoy.j2db.dataui.AbstractScriptLabel$5.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.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)
java.lang.ClassCastException: java.lang.Object
at com.servoy.r2.plugins.popupmenu.PopupMenuProvider.createMenuItem(PopupMenuProvider.java:236)
at com.servoy.r2.plugins.popupmenu.PopupMenuProvider.js_createMenuItem(PopupMenuProvider.java:122)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:347)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1254)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2031)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at com.servoy.j2db.develop.debugger.k.a(Unknown Source)
at com.servoy.j2db.develop.debugger.k.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.AbstractScriptLabel.a(Unknown Source)
at com.servoy.j2db.dataui.AbstractScriptLabel.access$5(Unknown Source)
at com.servoy.j2db.dataui.AbstractScriptLabel$5.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.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)
patrick can you send me the script you use to call the popupmenu plugin?
we have customers that are working fine with that plugin but somehow there is a call to it that gives that class cast exception.
I will also test the scheduler once more to see if it works.
The same goes for this one. Please give me a script how you call the scheduler.
ok i think i have found it.
Does it also give the classcast exception when you first load the soution?
Or only when you have done “Verify” once in the method editor?