tags:

views:

238

answers:

3

HI! I am looking for a document that will define what the word "rows[0]" means. this is for BIRT in the Eclipse framework. Perhaps this is a Javascript word? I dunno... been searching like mad and have found nothing yet. Any ideas?

+1  A: 

Typically code like rows[x] is accessing an element inside an array. Any intro to programming book should be able to define that for you.

rows[0] would be accessing the first element in the array.

Nate Bross
A: 

rows is a shortcut to dataSet.rows. Returns the current data rows (of type DataRow[]) for the data set associated with this report item instance. If this report element has no data set, this property is undefined.

Source: http://www.eclipse.org/birt/phoenix/ref/ROM_Scripting_SPEC.pdf

Ed Guiness
Spot on answer! Found the definitive reference I was looking for! You da man!
A: 

That operation has several names depending on the language, but generally the same concept. In Java, it's an array access expression in C#, it's an indexer or array access operator. As with just about anything, C++ is more complicated, but basically the [] operator takes a collection of something or an array and pulls out (or assigns to) a specific numbered element in that collection or array (generally starting at 0). So in C# ...

// create a list of integers
List<int> lst = new List<int>() { 1, 2, 3, 4, 5 }; 

// access list
int x = lst[0]; // get the first element of the list, x = 1 afterwords
x = lst[2];     // get the third element of the list, x = 3 afterwords
x = lst[4];     // get the fifth element of the list, x = 5 afterwords
x = lst[5];     // IndexOutOfBounds Exception
JP Alioto