Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Lookup a value - global, new table or extra field?

Quote Reply
Lookup a value - global, new table or extra field?
Hello,

Each one of my links has a LocationID. There are 300 different locations which hardly ever change.

Each LocationID has a matching name.

To get the name of the location, I could either:


  1. Add another field to the Links table called LocationName
  2. Write a global, which contains a list of all the location names and returns the name given the LocationID
  3. Add a new table called glinks_location which contains the columns LocationID and LocationName, and write a global which returns the name from the table given the ID
Considering there are 300 locations which do not change - which should I choose? Or is there another way?

Thanks in advance for your help!

Rob
Quote Reply
Re: [mrrob] Lookup a value - global, new table or extra field? In reply to
Do you have a table which holds these names?

i.e

Code:
LocationDetails
LocationID
LocationName

?

EDIT: just re-read your post =) I would go with the option of a new table, which could just be grabbed via:

Code:
sub {
return $DB->table('Locations')->select( ['LocationName', { LocationID => $_[0] } )->fetchrow;
}

(only an example - as I don't know what table structure you will have =))

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates

Last edited by:

Andy: Aug 28, 2008, 9:57 AM
Quote Reply
Re: [Andy] Lookup a value - global, new table or extra field? In reply to
Not yet, I'm wondering if that's the best way to do it.

Cheers,

Rob
Quote Reply
Re: [mrrob] Lookup a value - global, new table or extra field? In reply to
hahah that was a quick reply =)

I've just edited my post above - so maybe wanna check that out :)

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Lookup a value - global, new table or extra field? In reply to
Heh, heh - you were pretty quick too.

Thanks for the advice and the code - a big help as always.

All the best,

Rob
Quote Reply
Re: [Andy] Lookup a value - global, new table or extra field? In reply to
Me again :-)

If there was another type of location of which there were only 12 (which never change) - would a similar name lookup be ok in a global only, or is a new table still worthwhile in this instance?

Thanks!

Rob
Quote Reply
Re: [mrrob] Lookup a value - global, new table or extra field? In reply to
Its really up to you =)

Personally, if there were just 12 - I would make a new SELECT option in the Links table, which you could then just call with a simple tag call (instead of a global)

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Lookup a value - global, new table or extra field? In reply to
Thanks Andy