Please post your tables schema (CREATE TABLE ...) including some records in the related tables (INSERT INTO ... ).
Dynamic Selection List with Multiple Values
-
- User
- Posts: 11752
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');
-
- User
- Posts: 11752
- 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).
- To implement the multiple values, then you may just refer to the "table3".
- 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.
-
- User
- Posts: 11752
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.