This topic is locked

Feature Request

2/3/2020 2:22:18 PM
PHPRunner General questions
S
Steve Seymour author

It would be quite useful if it were possible save/ load/ re-use lookup lists.

Lists that don't require a separate lookup table such as YES,NO,N/A or 4 or 5 words only that don't really justify a new table.

If they could be loaded/saved from a text file and maybe even modified from code I think would be a nice addition.
Steve.

K
keithh0427 2/4/2020

I use a single lookup table with all of my options such as you mention along with the languages that I require in my project. The table structure is:
CREATE TABLE lookupkey (

key int(11) NOT NULL, // autoincrement

language varchar(12) NOT NULL,

lang_code char(2) NOT NULL,

type varchar(50) NOT NULL DEFAULT '', // category of sorts to narrow down what I'm looing for

value_num int(11) DEFAULT NULL, // use if the lookup value is numeric

value_var varchar(25) DEFAULT NULL, // otherwise, the lookup value is a string

display varchar(100) NOT NULL DEFAULT '', // the value to display to the yser

remark varchar(75) DEFAULT NULL, // this is for my own use in case I forgot what I did here

active enum('N','Y') DEFAULT 'Y' // for me to know if the lookup is currently active in my project. Sometimes, pieces will go inactive when I make some database changes

) // use whatever engine you need
Then, when I want to lookup something I use:
"type = 'yesno' AND active = 'Y' AND language='" . mlang_getcurrentlang() . "'"
Hope this helps.

S
Steve Seymour author 2/4/2020



I use a single lookup table with all of my options such as you mention along with the languages that I require in my project. The table structure is:
CREATE TABLE lookupkey (

key int(11) NOT NULL, // autoincrement

language varchar(12) NOT NULL,

lang_code char(2) NOT NULL,

type varchar(50) NOT NULL DEFAULT '', // category of sorts to narrow down what I'm looing for

value_num int(11) DEFAULT NULL, // use if the lookup value is numeric

value_var varchar(25) DEFAULT NULL, // otherwise, the lookup value is a string

display varchar(100) NOT NULL DEFAULT '', // the value to display to the yser

remark varchar(75) DEFAULT NULL, // this is for my own use in case I forgot what I did here

active enum('N','Y') DEFAULT 'Y' // for me to know if the lookup is currently active in my project. Sometimes, pieces will go inactive when I make some database changes

) // use whatever engine you need
Then, when I want to lookup something I use:
"type = 'yesno' AND active = 'Y' AND language='" . mlang_getcurrentlang() . "'"
Hope this helps.


Thanks, yes that will work. I think you see my suggested feature idea would be quite useful.

Sergey Kornilov admin 2/4/2020

I don't find it useful. Copying should be avoided at all costs. Everything should be in the database, multiple or single table like @keith0427 suggested.
Imagine the situation when you need to change the wording of one of those items or add a new one. You will have to find all those lookup wizards in all projects to make this kind of change. Sounds like a nightmare.

S
Steve Seymour author 2/4/2020



I don't find it useful. Copying should be avoided at all costs. Everything should be in the database, multiple or single table like @keith0427 suggested.
Imagine the situation when you need to change the wording of one of those items or add a new one. You will have to find all those lookup wizards in all projects to make this kind of change. Sounds like a nightmare.


We'll have to agree to differ on this.

I have projects written with "other" software where saving/loading a lookup list has proven to be very useful.

A
acpan 2/4/2020

My preference is to keep the lookup tables small and separated in the DB.
For common lookup tables, eg. yes/no, 1/0, i have lookup tables named lookup_yesno table for yes/no and lookup_onezero for 1/0.
it is simple enough and easy to maintain.
Just sharing my experiences, you may have other preferences tho'
ACP