Welcome, Guest
Username: Password: Remember me

TOPIC: Dynamic Enumeration Fields in single table

Dynamic Enumeration Fields in single table 24 Jan 2014 19:34 #12095

  • larctech
  • larctech's Avatar
  • Offline
  • New Member
  • Do what you can to make the world a better place..
  • Posts: 8
  • Karma: 0
Is it possible to create several enumeration fields within one table that end users can populate without having to make a completely separate table for each field? i.e.,

A company in "Branch A" only accepts certain equipment....in this case...it's computers......so they will build their lists using fields like

Service Type: Express, Standard, Overnight
System Make = Toshiba, Compaq, Dell, etc...
System Type = Laptop, desktop, netbook, etc...
Color = Black, White, etc...

Let's say another branch, B, doesn't work on computers...but they fix phones and they want their own list of equipment fields to use phone stuff and not reflect the computer list.


I would like to have have one back end page layout where each branch can have their own lists and alter them according to their own needs. I just can't seem to create a dynamic enumeration list that an end user can edit(add or remove listed items) without making a separate table and then linking it with a FK.

Any help will be greatly appreciated.
Last Edit: 24 Jan 2014 19:35 by larctech. Reason: adding a screenshot
The administrator has disabled public write access.

Dynamic Enumeration Fields in single table 25 Jan 2014 10:46 #12098

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
What is the problem creating a FK for this ?
Use enumeration only when the list is a pur static list.

FK are really simple to do, and you can group fileter the values using another FK winthin the list. (category)
Coding is now a piece of cake
The administrator has disabled public write access.

Dynamic Enumeration Fields in single table 25 Jan 2014 21:33 #12103

  • larctech
  • larctech's Avatar
  • Offline
  • New Member
  • Do what you can to make the world a better place..
  • Posts: 8
  • Karma: 0
What can I use like the enumeration field that isn't purely static? I want the end users to be able to add/remove items from this field instead of me hard coding the info.
The administrator has disabled public write access.

Dynamic Enumeration Fields in single table 29 Jan 2014 02:11 #12113

  • larctech
  • larctech's Avatar
  • Offline
  • New Member
  • Do what you can to make the world a better place..
  • Posts: 8
  • Karma: 0
do you have a step by step example of this? or a video?
The administrator has disabled public write access.

Dynamic Enumeration Fields in single table 07 Feb 2014 13:06 #12150

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Hi @lartech,

Please see www.j-cook.pro/index.php/forum/trouble-s...y-lookup-to-wo#12143

I appreciate what you're saying about the documentation - totally! However, what I will say is that there is a huge wealth of information on the forum which is highly, searchable when you bump into an issue/gap in your knowledge of cook.

If you search for 'foreign key', 'combo', 'FK' and a few variations, I assure you that you will find more info if required.

Hope the link helps!

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Dynamic Enumeration Fields in single table 10 Feb 2014 16:25 #12174

  • larctech
  • larctech's Avatar
  • Offline
  • New Member
  • Do what you can to make the world a better place..
  • Posts: 8
  • Karma: 0
Thanks for the response. I have search extensively through the forum and I can not find the information that I need. My initial question was how to make a backend accessible field type that allowed people to add their own information into a drop down viewable list. I know I can accomplish this by making a static list of items, but this will not server my purpose.

For example..a company has a bunch of branch offices, some do computer repair and others only service cell phones. I want to be able to create a section in the backend that they will be able to create their own individual list of "device types" that they are allowed to service in their particular branch office. I know i can accomplish this by creating a new table for each "device type" and then using a FK to connect to it and then populate it accordingly.....but this will not work if I do not know how many branch offices their will be or if they service completely different pieces of equipment in each office. so for example, 12 offices will need 12 different tables to create their own lists...but what if they only have 5 offices, or 100 offices.....you can see how this will be a nightmare to manage if they can not add/remove their own list items as they need to.


the example below illustrates the lists needed per branch office....see how the lists "MAKE" and "DEVICE TYPES" differ.
Branch NameService TypeMakeDevice Type
Branch 1ExpressDellLaptop
Two Day ServiceCompaqDesktop
StandardtoshibaNetbook

Branch NameService TypeMakeDevice Type
Branch 2ExpressHTCiPad
Two Day ServiceAppleAndroid Phone
StandardSamsungiPhone
Last Edit: 10 Feb 2014 16:27 by larctech. Reason: grammer
The administrator has disabled public write access.

Dynamic Enumeration Fields in single table 10 Feb 2014 18:36 #12175

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
On the concerned table storing the values, you add a field (FK), to the user, or to the company...

So every user will have different virtual lists in the same table. See how the Joomla categories works....

It seems a lot of different lists, but all items are physically stored in the same table.
All you need to do is to filter the list before to get the items.

In the view file, the lists are populated.
Just BEFORE $model->getItems()
add : $model->addWhere ('a.myClient' = $item->my_client_value)

Well, myClient is the FK pointing to what you want to group the lists.
From the form, you must have available the current group ID, it is the meaning of $item->my_client_value.

Hope it helps.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.132 seconds

Get Started