Dynamic Selection List with Multiple Values

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
mobhar
User
Posts: 11752

Re: Dynamic Selection List with Multiple Values

Post by mobhar »

Please post your tables schema (CREATE TABLE ...) including some records in the related tables (INSERT INTO ... ).


mobhar
User
Posts: 11752

Post by mobhar »

From those 3 tables above, how did you setup your Dynamic Selection List? In which table? In which fields? Please explain it to us.


mobhar
User
Posts: 11752

Post by mobhar »

Unfortunately, the sample data in "equipment" table is not enough to be displayed in "equipid" field of "works" table.

Please refer to "Tutorial - Dynamic Selection List" in PHPMaker Help menu.


mobhar
User
Posts: 11752

Post by mobhar »

If you would like to implement the multiple values for the Dynamic Selection List, you may try the following tables schema:


-- Table structure for table1


DROP TABLE IF EXISTS table1;
CREATE TABLE table1 (
Code1 char(3) NOT NULL,
Description1 varchar(50) DEFAULT NULL,
PRIMARY KEY (Code1)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


-- Records of table1


INSERT INTO table1 VALUES ('001', 'One');
INSERT INTO table1 VALUES ('002', 'Two');
INSERT INTO table1 VALUES ('003', 'Three');


-- Table structure for table2


DROP TABLE IF EXISTS table2;
CREATE TABLE table2 (
Code1 char(3) NOT NULL,
Code2 char(3) NOT NULL,
Description2 varchar(50) DEFAULT NULL,
PRIMARY KEY (Code2,Code1)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


-- Records of table2


INSERT INTO table2 VALUES ('001', '001', 'First Detail in First');
INSERT INTO table2 VALUES ('001', '002', 'Second in First');
INSERT INTO table2 VALUES ('001', '003', 'Third in First');
INSERT INTO table2 VALUES ('002', '004', 'First in Second');
INSERT INTO table2 VALUES ('002', '005', 'Second in Second');
INSERT INTO table2 VALUES ('002', '006', 'Third in Second');
INSERT INTO table2 VALUES ('002', '007', 'Fourth in Second');
INSERT INTO table2 VALUES ('003', '008', 'First in Third');
INSERT INTO table2 VALUES ('003', '009', 'Second in Third');
INSERT INTO table2 VALUES ('003', '010', 'Third in Third');
INSERT INTO table2 VALUES ('003', '011', 'Fourth in Third');


-- Table structure for table3


DROP TABLE IF EXISTS table3;
CREATE TABLE table3 (
Code1 char(3) NOT NULL,
Code2 varchar(100) NOT NULL,
Description3 varchar(100) DEFAULT NULL,
PRIMARY KEY (Code1,Code2)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


-- Records of table3


INSERT INTO table3 VALUES ('001', '001,003', 'First description in table3');
INSERT INTO table3 VALUES ('002', '005,006,007', 'Second description in table3');
INSERT INTO table3 VALUES ('003', '008,010', 'Third description in table3');


mobhar
User
Posts: 11752

Post by mobhar »

  1. From those 3 tables I posted above, you need to provide at least two tables ("table1" and "table2") which will become the normal Master/Detail (one-to-many relationship).
  2. To implement the multiple values, then you may just refer to the "table3".
  3. As you can see the field "Code2" in "table3" contains the multiple values that derived from "table2" which has "Parent field" to "Code1" and "Filter field" to "Code1", too.

mobhar
User
Posts: 11752

Post by mobhar »

Please note that you have to make sure setup "Code1" in "table3" as "Lookup Table" (using Select or Combobox) to "table1", afterwards, setup also "Code2" in "table3" as "Lookup Table" to "table2" which has "Multiple" enabled, "Parent field" to "Code1", and "Filter field" to "Code1", too.


mobhar
User
Posts: 11752

Post by mobhar »

I have never used your pattern for multiple values in Dynamic Selection List. That's why I could not offer you the solution using your table schema.


Post Reply