[ic] Select box with external table lookup in UI

Ed LaFrance interchange-users@interchange.redhat.com
Wed Sep 19 12:28:00 2001


At 09:36 PM 09/18/2001 -0400, you wrote:
>Quoting Ed LaFrance (edl@newmediaems.com):
> > At 12:06 AM 09/19/2001 +0200, you wrote:
> > >Ed LaFrance <edl@newmediaems.com> writes:
> > >
> > > > Hi all -
> > > >
> > > > 4.6.5 and 4.8.1: Just curious if anyone has been able to set up a 
> select
> > > > box widget in the UI, so that it contains a list of unique values 
> from an
> > > > external database?  For instance, setting up the category selector for
> > > > Items so that is displays every unique entry in the cat table
> > > (currently is
> > > > simply lists unique choices from the category column of the products
> > > table).
> > > >
> > > > I have not been able to get it to work with any combination of simple
> > > > settings in the meta editor; It appears something more elaborate 
> may be
> > > needed.
> > >
> > >What do you mean with external database ? It is no problem to fill the
> > >select box with values from another table.
> >
> > Sorry, I meant external *table*, bad habit.  If I set the meta data as 
> follows:
> >
> > widget type             ->      select box
> > lookup table            ->      external_tablename
> > field for lookup        ->      fieldname in external table
>
>That is correct. To verify, check the table itself (with Jon's te editor
>or a spreadsheet:
>
>code:table::column
>db:external_tablename
>lookup:field
>type:select
>
>I have used this many times, so I know it works.
>--

Thanks Mike, lookup:field was what I was missing - I was trying instead to 
use 'code,name' in 'Fields for lookup', which seemed correct according to 
my read of the field help, but it appears the note about commas-separated 
fieldname pairs does not apply to the select box widget?  The help for the 
meta options is a little unclear, I think - things do not quite work 
according to the way the field help reads, at least to me.  So for the 
benefit of all, to get a category selector for the item editor derived from 
the actual contents of the cat table, in which the category name is 
displayed in the select box, and the category code is the value of each 
option, I did the following (meta editor for products::category):

Widget Type             ->      Select Box
Lookup select           ->      code
Field for lookup        ->      name
Lookup table            ->      cat

Tested in 4.6.5 and 4.8.1.

- Ed L.




===============================================================
New Media E.M.S.               Software Solutions for Business
463 Main St., Suite D          eCommerce | Consulting | Hosting
Placerville, CA  95667         edl@newmediaems.com
(530) 622-9421                 http://www.newmediaems.com
(866) 519-4680 Toll-Free       (530) 622-9426 Fax
===============================================================