|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4715 Location: Pensacola, FL, USA
|
Posted: Sun Sep 19, 2010 2:21 am
%json triggers? |
I had a question regarding nested tables and such...
With a given variable constructed with:
#ADDITEM people.stimpy {desc=a fat red tailless cat}
#ADDITEM people.stimpy {color=tomato}
#ADDITEM people.ren {desc=a malnourished jittery runt of a dog}
How would i construct a trigger pattern to fire off the 3rd layer desc and still be able to reference the 2nd layer parent for the name?
#TR {({@people..desc})} //double dot indentation?
I want the value of the trigger to be something like:
$desc=%params(1)
$color=lawngreen
#SUB {%parent(@people, $desc)}
#IF (@people.%parent(@people, $desc).color) {$color=@people.%parent(@people, $desc).color}
#CW $color
There is no %parent function that i know of to retrieve data like this, its just a contrived example for an idea i had |
|
_________________ Discord: Shalimarwildcat |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Mon Sep 20, 2010 6:34 pm |
Well, the basic problem is that you can't have a trigger like that.
A trigger pattern can contain a stringlist or a key/value list. If it is a key/value list, then the keys are used as if they were a stringlist. To make a trigger that catches what you want, you will need to create a key/value list whose keys are the set of values of desc, and whose values are the names. There isn't any way to do that on-the-fly from your table. The only way to do it would be to create a separate variable (or subtable) with the descriptions and names as key/value pairs. |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4715 Location: Pensacola, FL, USA
|
Posted: Wed Sep 22, 2010 4:38 pm |
Well that is a conundrum then... we need a way to use a given field in a dbvar as a stringlist without needing to make a separate setting.
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
|
|