Output the array completely

Questions, tips and tricks and techniques for scripting in Servoy

Output the array completely

Postby Leendert » Fri Jul 30, 2010 11:55 am

I want the dataprovider in an array so I use the code:
var a = new Array();
a = databaseManager.getFoundSetDataProviderAsArray(forms[_form].foundset, 'pers_id');

It seems to work. The code application.output(‘Size: ’ + a.length) gives me: Size : 738.

However application.output(a) gives me: [862,285,731,537,690,1491,944,763,1934,396,924,1059,614,1715,321,1480,593,1094,1000,364,1138,395,1887,252,1789,117,1955,265,263,1499,581,760,1624,1954,1849,839,1156,974,1560,1602,1485,546,268,858,715,1593,224,1832,1149,849,1774,1509,1883,1221,638,1461,851,831,185,239,788,1670,1673,340,1939,1023,1305,1949,1176,661,681,253,1151,656,1694,1211,258,1652,1209,254,1319,1206,429,1870,1781,1192,1559,1386,1806,362,1839,1831,978,1776,1453,750,1767,181,688,1583]

Those aren’t 738 numbers.
Is there a way to show all the 738 numbers?
Leendert Plug

Servoy Developer
Version: 5.1.0 - build 956
Java version 1.6.0_17 (Windows 7)
db: Oracle 10GR2
User avatar
Leendert
 
Posts: 64
Joined: Tue Oct 02, 2007 1:44 pm
Location: Hengelo, Netherlands

Re: Output the array completely

Postby lvostinar » Mon Aug 02, 2010 4:22 pm

I guess this is in developer console ? I can display just fine 738 elements in there. What do you see in debug mode ? (Variables,Interactive Console)
Laurian Vostinar
Servoy
lvostinar
 
Posts: 1062
Joined: Tue Feb 19, 2008 10:53 am

Re: Output the array completely

Postby Leendert » Tue Aug 03, 2010 9:32 am

The interactive console outputs for variable a: array[738]

How can you see all the 738 values and I don't?
Leendert Plug

Servoy Developer
Version: 5.1.0 - build 956
Java version 1.6.0_17 (Windows 7)
db: Oracle 10GR2
User avatar
Leendert
 
Posts: 64
Joined: Tue Oct 02, 2007 1:44 pm
Location: Hengelo, Netherlands

Re: Output the array completely

Postby lvostinar » Tue Aug 03, 2010 9:40 am

Leendert wrote:The interactive console outputs for variable a: array[738]

How can you see all the 738 values and I don't?


Can you post a small sample that doesn't work ?
Laurian Vostinar
Servoy
lvostinar
 
Posts: 1062
Joined: Tue Feb 19, 2008 10:53 am

Re: Output the array completely

Postby jcompagner » Tue Aug 03, 2010 9:43 am

in code you just loop over it in a for loop and print out the index..
toString() will not print everything that is way to dangerous in a developer environment, what happens if the array is 10K big?? These are just safe guards.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Output the array completely

Postby Leendert » Tue Aug 03, 2010 10:16 am

I've looped over it with a for loop like Johan Compagner told me. It worked :D

Thanks for helping!
Leendert Plug

Servoy Developer
Version: 5.1.0 - build 956
Java version 1.6.0_17 (Windows 7)
db: Oracle 10GR2
User avatar
Leendert
 
Posts: 64
Joined: Tue Oct 02, 2007 1:44 pm
Location: Hengelo, Netherlands

Re: Output the array completely

Postby Vaj » Tue Aug 03, 2010 3:29 pm

Just out of curiosity, wouldn't array.join('\n') output the whole array as a string and you can check if there are 768 elements in there? or is that the same as using .toString() and is to dangerous in a developer environment?
V Rathnayaka
Senior Systems Developer.
Space Air plc.
User avatar
Vaj
 
Posts: 64
Joined: Fri Jul 21, 2006 10:14 am
Location: Surrey, UK

Re: Output the array completely

Postby jcompagner » Tue Aug 03, 2010 3:31 pm

that should work fine also.. didn't think about that..
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Methods

Who is online

Users browsing this forum: No registered users and 14 guests