|
Yodous Apprentice
Joined: 23 Jun 2004 Posts: 105 Location: Poland
|
Posted: Sat Jul 30, 2005 5:00 pm
Something like %item but in data record |
Hello!
I'm thinking about function, that will works like %item in string lists, but with data record variables.
Eg.
data = ogr=1|gnome=2|dwarf=3
etc etc.. let's say we have 100 position in variable data.
How to simply and fast take 3th position from @data ?
If it where a string list, I can make %item(@data,3). But this is data record. How to do it without loops? Any ideas? |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sat Jul 30, 2005 8:42 pm |
%db(@data,dwarf)
|
|
|
|
Yodous Apprentice
Joined: 23 Jun 2004 Posts: 105 Location: Poland
|
Posted: Sun Jul 31, 2005 7:52 am |
Nexela I has written that I want the 3th position in variable, and I don't know that 3th is dwarf
I dont want to use loop.
I want just something like %item(@data,3) but this wouldn't work with data record variable. |
|
|
|
Dharkael Enchanter
Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Sun Jul 31, 2005 11:30 am |
Code: |
#VAR getN {%item(%expanddb(@data,|,|),%eval(%1*2))} |
#EVAL @getN(3) |
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
|
Yodous Apprentice
Joined: 23 Jun 2004 Posts: 105 Location: Poland
|
Posted: Sun Jul 31, 2005 11:42 am |
Heh, yea. This is some way.
Thx Dharkael.
By the way. Maybe somedays will be option to numeric positions in data record variable. |
|
|
|
|
|