Servoy 6 Array Problem

Forum to discuss the Web client version of Servoy.

Servoy 6 Array Problem

Postby Janssenjos » Thu Jan 05, 2012 9:25 am

Hi All,

I'm trying to convert my current solution to servoy 6.
My code is as followed, the on_action is of a button on a form:
Code: Select all
/**
* @properties={typeid:35,uuid:"416806F7-2E66-4599-A3AB-2E5453438994",variableType:-4}
*/
var testArray = null;

/**
* Perform the element default action.
*
* @param {JSEvent} event the event that triggered the action
*
* @properties={typeid:24,uuid:"11AFE23C-EEBA-43E8-ABAF-8DCD205C0F74"}
*/
function onAction(event)
{   
   testArray = new Array();
   
   testArray[-999999] = "hello";
   testArray[1] = "Hello to you";
   
   // ex 1) Execute simple Client-Side Javascript (Web-Client only)
   var jsToExecute = "alert('"+testArray[-999999]+"');";
   plugins.WebClientUtils.executeClientSideJS(jsToExecute);
   
   // ex 1) Execute simple Client-Side Javascript (Web-Client only)
   var jsToExecute = "alert('"+testArray[1]+"');";
   plugins.WebClientUtils.executeClientSideJS(jsToExecute);
}


The first time i click the button, the code works.
The second time i click the button, it breaks on 'testArray = new Array();' with the following error:

Code: Select all
-999999
Wrapped java.lang.ArrayIndexOutOfBoundsException: -999999 (C:\Servoy_Workspaces_6\TestSol\forms\test.js#17)
   at C:\Servoy_Workspaces_6\TestSol\forms\test.js:17 (onAction)



I don't understand why?
What do I have to change to get this working in servoy 6?
Jos Janssen
Software Developer
Axerrio
http://www.axerrio.com
Janssenjos
 
Posts: 148
Joined: Thu Aug 13, 2009 3:55 pm
Location: Bergen op Zoom

Re: Servoy 6 Array Problem

Postby jcompagner » Mon Jan 09, 2012 6:24 pm

the change you currently have to do is not to use a negative index.

Can you make a case for this with that sample code in our support system?
So that we can fix this problem with an javascript array with negative indexes?
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Servoy 6 Array Problem

Postby jcompagner » Mon Jan 09, 2012 6:41 pm

i did find a solution for this, will be fixed for the next 6.0.x release
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Servoy 6 Array Problem

Postby Janssenjos » Tue Jan 10, 2012 10:08 am

thanks,

so i don't have to make a case?
Jos Janssen
Software Developer
Axerrio
http://www.axerrio.com
Janssenjos
 
Posts: 148
Joined: Thu Aug 13, 2009 3:55 pm
Location: Bergen op Zoom

Re: Servoy 6 Array Problem

Postby jcompagner » Tue Jan 10, 2012 11:07 am

No need for that now, already checked in a fix
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Servoy Web Client

Who is online

Users browsing this forum: No registered users and 12 guests