[thelist] late night freebie

.jeff jeff at members.evolt.org
Fri Aug 23 06:52:01 CDT 2002


hey all,

working on a project with a nasty deadline and discovered a neat little trick so i thought i'd post it as a tip.

<tip type="ColdFusion" author=".jeff">

ever catch yourself with a query in one hand and an id from one of the records in that query in the other hand and wondering what the easiest way to find out what row in that query the id belongs to?

don't mess with loops.  just use a couple of functions nested together.

first, convert the column that holds the value you wanna find the row for.

ValueList(query.column)

second, use a list function to find the position of the value within that list.  the position in the list is the same as the row in the query.

ListFind(ValueList(query.column), value);

assign that to a variable and you can use that variable to grab a different column in the same row of the query.

i = ListFind(ValueList(query.column), value);
title = query.title[i];

</tip>

enjoy,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/




More information about the thelist mailing list