Error running search script on form

Hi all,

I have the following method that does a search:

controller.find();
if (globals.Field1_number)
{
subj_num = globals.Field1_number
}
var x = controller.search();
if (x ==0 )
{
//Nothing was found
var btn = globals.Error_MSG('No matches found for ’ + globals.Field1_number, ‘Cancel’, ‘Try Again’ );
if (btn == ‘Try Again’)
{
globals.Field1_number = null
}

else
{
controller.loadOmittedRecords();

}
}

///

Once I call the above method I get the following error:

Error:
Java.lang.illegalArgumentException: Cannot format given Object as a Date(Search_Subj_num, line 10)

///
Line 10 is:
var x = controller.search();

The above script works fine in any other forms that we have.
I recreated the form, but still errors upon calling the above method.

Thanks for any help.

Abrahim

It looks like you are putting an date-object into a text object? or viceversa?

check what type is: subj_num
and check what type is: globals.Field1_number

Hope this helps.

Harjo,

I double check the following filed and they are not date filed:
Subj_num is integer
globals.Field1_number is number

I recreated the form and method, but I still get the same error.

Abrahim

which version of servoy do you use?
That exception doesn’t seem to be one of servoy itself (if conversion of dataproviders don’t work) so it seems to go somewhere else wrong.

If youre are testing with 2.2RC7 then i would like to have a reproduceable solution.

Johan,

Servoy developer version: R2 2.1.2-build 315
Table name: ABC
Form name: ABC
Here is what I have done so far:

Created a new global variable with type “Number” and still getting the same error.
Duplicated the form, and still getting the same error.
Recreated the same form and method, and still getting the same error.
I created a new solution with a new ABC form, and then tried the script. It works fine.

Enabled the debugger and points to line: var x = controller.search

Thanks for any help.

Abrahim

Johan,

The problem has been fix by deleting the ABC form and recreating it again.

Thanks for any help.

AbrahimThe problem has been fixed by deleting the ABC form and recreating it again.

Thanks for any help.

Abrahim