User:Najevi/array extension

Compare right-hand column results against this page

version::1.2.2

for general documentation: http://www.mediawiki.org/wiki/Extension:ArrayExtension

deal with SMW query results
1. create an array from SMW query result
 * target total:
 * SMW query result:
 * arraydefine result:
 * arraydefine size:


 * target total:
 * SMW query result:
 * arraydefine result:
 * arraydefine size:

note: there is a limitation when SMW does not return all results

2. list unique values of a property in descending order
 * target total:
 * SMW query result:
 * arraydefine result:
 * arraydefine size:


 * target total:
 * SMW query result:
 * arraydefine result:
 * arraydefine size:

print array

 * now more powerful (can do some foreach work)

other print options

 * the input array b:
 * the input array f:

create new array

 * array a:


 * array b:


 * array c:

handle multi-dimension array
In order to access a 2D array "red;#da2021, yellow;#fcff00, green;#00ff00", we can take the following steps:

1. split the array into an array:


 * colors[0]:
 * size of colors:

2. split the first element into an array


 * colors[0][0]:
 * size of colors[0]:

Note, it is also possible to use variable (require VariablesExtension)


 * i=0
 * colors[i][0]:
 * size of colors[i]:

iteratively access array members
source code

output