[jh_arrayofpositions]

Description

Link: [jh_arrayofpositions]
Author: James harvard
Category: Array
Version: 7.x
License: Public Domain
Posted: Nov. 29, 2009
Updated: Jan. 01, 0001
More by this author...

Parameters

none


Sample Usage

var( 'sort_column_values' = array );

rows;
	$sort_column_values->insert( integer(field('col_name')) );
/rows;

var( 'positions' = jh_arrayofpositions($sort_column_values) );

'<table>';
rows;
	'<tr><td>';
	field('col_name');
	'</td><td>';
	$positions->get(loop_count);
	'</td></tr>';
/rows;
'</table>';
						

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
1
2
3
4
5
6
7
8
9
10
define_tag( 'jh_arrayofpositions', -required='a', -type='array' );
	local( 'i' = null, 'out' = array, 'indx' = null );
	#out->reserve( #a->size );
	iterate( #a, #i );
		#indx = #a->findindex(#i) ;
		#out->insert( #indx->last + ( #indx->size != 1 ? '=' ) );
	/iterate;
	return( @ #out );
/define_tag;

 

Comments

none

Email:


Password:



Newest

Most Popular

Support tagSwap.net