[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] [data] tag using not the key for the key
Quoting Russ Mann (tech@khouse.org):
> Hello List,
>
> I made another table to make drop-down DB lookup widgets happen for dynamic
> sidebar search link fields.
>
> Here's an example of the DB fields:
>
> code
> sub_category
> extra_text
>
> What I need to be able to do is access the data in the field "extra_text"
> with only knowing the value of sub_category.
>
> [data table=media_type column=extra_text key='[item-field sub_category]']
>
> This is the tag that doesn't work, and I'm sure the reason it doesn't work
> is the [data] tag is "keying" on the code field instead of the sub_category
> field. How can I modify which field the "key" is keyed to?
You can't, but you can do a "foreign key lookup". If sub_category is
unique, in later MV versions you can do:
[data table=media_type column=extra_text foreign=sub_category key=foo]
If sub_category is not unique, it will return the first matching value.
You would need to do a query to get all of the matching items.
You might want to do some reading on basic database stuff; this is what
is called a foreign key. You will learn why you may need to do a
sub-query of some type with custom code.
--
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH 45013
phone +1.513.523.7621 <mheins@redhat.com>
Being against torture ought to be sort of a bipartisan thing.
-- Karl Lehenbauer