|
Anrok Apprentice
Joined: 19 Nov 2010 Posts: 119
|
Posted: Thu Nov 25, 2010 7:18 pm
Database variables again.. |
Ok this might sound like a very stupid question but say i've got a database variable called test with
Key=Value
test1=nice1
test2=nice2
test3=nice3
Now if i type @test.test1 it will return me the value of nice1, if i use %db(@test,test1) and finally if i use @test.1 it will return me nice1 again. Is there any way to access the name of the key without using #loopdb ? Having 3 ways to see value and no way to see a key is weird, or am i missing something ? |
|
|
|
Anrok Apprentice
Joined: 19 Nov 2010 Posts: 119
|
Posted: Thu Nov 25, 2010 8:15 pm |
Oh found a 4th way to access a value now! %item(@dbvar, linenumber) will not retrieve a key..
|
|
|
|
Fizgar Magician
Joined: 07 Feb 2002 Posts: 333 Location: Central Virginia
|
Posted: Thu Nov 25, 2010 8:22 pm |
Not sure how you want to use this so here it is in the form of an alias.
Code: |
<alias name="GetKey" id="12">
<value>$val = %isvalue(@test,%-1)
$key = %dbkey(@test, $val)
#show {$key} </value>
</alias> |
typing getkey nice3 will return test3 |
|
_________________ Windows Vista Home Premium SP2 32-bit
AMD Athlon Dual Core 4400+ 2.31 GHz
3 GB RAM
CMUD 3.34 |
|
|
|
Anrok Apprentice
Joined: 19 Nov 2010 Posts: 119
|
Posted: Thu Nov 25, 2010 8:25 pm |
hmm , says invalid local variable $key
|
|
|
|
Anrok Apprentice
Joined: 19 Nov 2010 Posts: 119
|
Posted: Thu Nov 25, 2010 8:28 pm |
Ah nice, looked through your script and found out that i wasnt using %dbkey before ;) That's the command i was looking for (almost), thanks! Still would be nice to have a way to acess dbkey by providing a dbvalue!
|
|
|
|
Anrok Apprentice
Joined: 19 Nov 2010 Posts: 119
|
Posted: Thu Nov 25, 2010 8:35 pm |
Thank you Fizgar, that allowed me to complete my trigger at last :)
|
|
|
|
|
|