|
coamenel Newbie
Joined: 31 Aug 2005 Posts: 7
|
Posted: Fri Jan 13, 2006 2:29 pm
#loopdb and trigger creation |
Hi,
I'm trying to use #loopdb to create a trigger, but i'm having problems expanding the %key in my #trigger statement.
what i have now is:
[code]
#loopdb @prices {#TRIGGER {^~"%w~"(%d)%s%key} {#additem %key %%1 _nodef}}
[/code}
Which gives me a trigger like this:
[code]
Pattern:
^~"%w~"(%d)%s%key
Value:
{#additem %key %%1
[/code]
I've tried all the expansion method's i could possibly think of (like <>, {}, (), [] and the %expand() function). But none of those helped me out. Is making a trigger like this not possible at all?
Any help is much appreciated! |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Fri Jan 13, 2006 7:01 pm |
I'm not sure of your exact goal here, but could you just make triggers that reference the data record variable directly? If the keys are only one word, it should work to do something like this instead:
#TRIGGER {^~"%w~"(%d)%s@prices.keyname} {#additem keyname %1 _nodef}
I know it doesn't help you with the #loopdb problem. If the @prices keys are fairly static, this could be a different way to try it. |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sat Jan 14, 2006 12:29 am |
This is a somewhat complex problem. First is that you can use a record variable within a trigger pattern. The trigger will fire for key matches,
Code: |
{#TRIGGER {^~"%w~"(%d)%s{@prices}} |
The second issue is with the expansion, that you mention is a problem. The main way to bypass the defined expansions for various command is with #EXECUTE and %concat. So far I don't see enough in your question to say that this is the best way to go.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
|
|