Servoy 2.2rc4

Release notes for Servoy betas

Postby pbakker » Tue Apr 12, 2005 7:06 pm

Get it, yes, that's a good improvement. Worth the work of setting the anchors everywhere... :lol:
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby jcompagner » Tue Apr 12, 2005 7:59 pm

eval should be fixed now in this version:

http://downloads.servoy.com/beta/22x_product/js.jar

about the array's
yes all arrays should be the same now so the to string of javascript or java arrays should behave and display the same so with the [10,10,10]
When do you need it without the brackets? Because a toString impl is just what it is a toString (mostly for debugging).
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby Harry Catharell » Tue Apr 12, 2005 11:27 pm

Hi Johan,

That does seem to solve the problem with eval ( )

What actually caused the problem ?

Thanks
Harry
Harry Catharell
 
Posts: 812
Joined: Fri Sep 26, 2003 10:23 am
Location: Milton Keynes, England

Postby jcompagner » Tue Apr 12, 2005 11:39 pm

the new internal javascript string handling.

If somebody could test this with some reports/large concatting of strings. Now this should be really speeded up.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Difference in Anchor values

Postby Karel Broer » Wed Apr 13, 2005 10:19 am

It seems that 2.2rc4 handles Anchors different. I use (for example) a tableview form in a tabpanel, and had to change the Anchors from the fields to 'none' to show a dynamic window again.
Before the update I only had to set the tabpanel anchors....

Good thing in this beta is, that it handles images in a tableview much better!
As for as my opinion, this is an improvement, not a bad bug :wink:
Karel Broer
ServoyCamp - http://www.servoycamp.com
User avatar
Karel Broer
 
Posts: 779
Joined: Mon May 03, 2004 12:49 am
Location: Doetinchem

Postby patrick » Wed Apr 13, 2005 10:22 am

jcompagner wrote:about the array's
yes all arrays should be the same now so the to string of javascript or java arrays should behave and display the same so with the [10,10,10]
When do you need it without the brackets? Because a toString impl is just what it is a toString (mostly for debugging).


The brackets are absolutely disturbing. For example, we now have a query that looks like this:

... WHERE (kontakte_benutzer.uid_benutzer IN ('[4]') ...


which is completely wrong because there should be simply a "4" and not a "[4]".

The query comes from this (in short):

Code: Select all
for (i = 1; i <= vAnzahlZeilen; i++)
   {
      vResult[i-1] = new Array(vAnzahlSpalten)
      
      for (j = 1; j <= vAnzahlSpalten; j++)
         {
            vResult[i-1][j-1] = vDataSet.getValue(i, j);
         }
   }
return vResult;


and then

Code: Select all
vResult = '\'' + vUidBenutzer.join('\', \'') + '\'';


This worked nice before, but now instead of '4' it delivers '[4]'.
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Postby patrick » Wed Apr 13, 2005 10:43 am

This Array issue is getting worse the more I click around. I have, for example, a method that calls another method passing arguments in an array. The Array is constructed here:

Code: Select all
globals.datensatzNeu('kontakte_briefe', dataset, true, null, null, 'briefNeu', new Array('\'einzelansicht\'', vGuid));


Then in globals.datensatzNeu I do

Code: Select all
methodArgs = arguments[6]; // retrieves the Array
// and then later:
if (methodArgs)
   {
      var args = methodArgs.toString();
      method += '(' + args + ')'
      eval(method);
   }
// NOW leads to method   
forms.aForm.briefNeu(['einzelansicht',19])


The method that is called using eval does

Code: Select all
var form = arguments[0];
var vGuid = arguments[1];


which NOW leads to

form = [einzelansicht,19]
vGuid = undefined

instead of

form = einzelansicht
vGuid = 19

Guys: this is hell!! We use this kind of logic all over the place. This needs to be fixed, otherwise I am thrown back one month.
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Postby jcompagner » Wed Apr 13, 2005 10:57 am

as i a said..
the toString of an array is REALLY not meant for this!!
For example if you have a large number of elements (i don't know currently how much) then you will get [x,y,z,......]

That is how a to string on an array works.
If you really want arrays to just do: x,y,z and nothing more
then you need to make youre own function that does that.
(we could make such a functions in utils.xxx or something like that)
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby pbakker » Wed Apr 13, 2005 11:06 am

Patrick,

Isn't the command to use here arrayxxxx.join(',')?
for example:
Code: Select all
a = new Array("Wind","Rain","Fire")
myVar1=a.join()      // assigns "Wind,Rain,Fire" to myVar1
myVar2=a.join(", ")  // assigns "Wind, Rain, Fire" to myVar1
myVar3=a.join(" + ") // assigns "Wind + Rain + Fire" to myVar1


check out: http://www.croczilla.com/~alex/reference/javascript_ref/array.html#1195456

This should give you all the entries in the array as a comma separated string.

DEfault Javascript Arrayxxxx.toString should only return the name of the array + the hashcode

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby jcompagner » Wed Apr 13, 2005 11:11 am

thx!
didn't think about join.. but yes that should be used.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby patrick » Wed Apr 13, 2005 11:14 am

What I want here is to turn an array into item1, item2, item3. I know there can be many items and so forth, but I know what I am doing here. It did work before and it should work now. toString should deliver the items of an array in a string just like it did before. I can fix it at this specific point using join, but I also have the problem described above, where I get '[4]' instead of '4'.

What was the big issue that is fixed now? I need to check my code all over the place now and see what my arrays return. Arrays did behave as I expected ever since I use Servoy until today. :cry:
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Postby pbakker » Wed Apr 13, 2005 11:20 am

In which part of the first described problem do you get the brackets? Because in the sample specified, I see neither .toString() or join used (except for the last line).
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby patrick » Wed Apr 13, 2005 11:22 am

right here:

Code: Select all
vResult[i-1][j-1] = vDataSet.getValue(i, j);


where vDataSet is a dataset.
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Postby pbakker » Wed Apr 13, 2005 11:41 am

So, vDataSet.getValue(i, j); returns a value imbedded by brackets?

If that is so, I think that is a bug indeed.

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby jcompagner » Wed Apr 13, 2005 12:17 pm

that is not the case.
What is that vUidBenutzer???
What kind of data is inside that??
is it the result of the first code fragement where you do return vResult?

I think that is the case and then it is logical that you are getting the result you are getting

because vUidBenutzer is a 2 dim array.

and you hare sayint to the 2 dim array that it should join.
So what happens is that the first array that already has arrays as elements just joins the arrays it self has.

and first array just does a toString on its elements (that again are arrays) and then will make [].
Why do you have multi dim array?

If you just want a list of ids why are you not concatting those to one array?

Code: Select all
vResult = new Array();
for (i = 1; i <= vAnzahlZeilen; i++)
   {
      for (j = 1; j <= vAnzahlSpalten; j++)
         {
            vResult[vResult.length]= vDataSet.getValue(i, j);
         }
   }
return vResult;


before RC4 there was a difference in javascript and java arrays. So java arrays did return a toString of "[x,y]" and javascript arrays did not. Also java other behaviour was different. Now they are all the same. It should be completely transarent.
But depending on the toString imp of a array is bad behaviour for example

i could make it the other way around. But then i also have to remove all the length checks that toString does for example > 100 will not be printed.

But if we do that then the debugging arrays is a bit ugly because the strings that a big array could return would be very very big. And that is just what the toString is meant for: Debugging output.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

PreviousNext

Return to Latest Releases

Who is online

Users browsing this forum: No registered users and 30 guests