I have a table "sourcedata" with four fields each with data as a comma-separated list. I need to create a table "newdata" with one record for each combination of these data. The data is from an outside source and represents "rooms", "lecturers", "subjects" and "week numbers".
Sample record from "sourcedata" is:
field1 A-307, B-405,
field2 jones 200,smith2,
field3 chinese ,japanese, korean,
field4 2,4-6,9,12-15, 17,19-23,35,42-49,52,
In each field the number of items could be none, one or many. In the first three fields there will be maximum of about four items. The fourth field contains numbers and ranges denoted by hyphens so in the sample it means weeknumbers 2,4,5,6,9,12,13,14,15,17,19,20,etc. In any field there could be spaces (in random positions).
Each record from "sourcedata" will be used to make many records in "newdata", with fields ROOM/TEACHER/SUBJECT/WEEKNR. From the sample, records in "newdata" will look like
A-307/jones 200/chinese/2
A-307/jones 200/chinese/4
A-307/jones 200/chinese/5
etc
B-405/jones 200/japanese/2
B-405/jones 200/japanese/4
etc
This sample would lead to 2x2x3x25=300 records in "newdata".
A new "sourcedata" table is provided at least daily, then reports from "newdata" are generated which provide tailored timetables.
Suggestions, please, for a method of converting "sourcedata" to "newdata", preferably using action scripting rather than xbasic.
Thanks, Steve Martin
Sample record from "sourcedata" is:
field1 A-307, B-405,
field2 jones 200,smith2,
field3 chinese ,japanese, korean,
field4 2,4-6,9,12-15, 17,19-23,35,42-49,52,
In each field the number of items could be none, one or many. In the first three fields there will be maximum of about four items. The fourth field contains numbers and ranges denoted by hyphens so in the sample it means weeknumbers 2,4,5,6,9,12,13,14,15,17,19,20,etc. In any field there could be spaces (in random positions).
Each record from "sourcedata" will be used to make many records in "newdata", with fields ROOM/TEACHER/SUBJECT/WEEKNR. From the sample, records in "newdata" will look like
A-307/jones 200/chinese/2
A-307/jones 200/chinese/4
A-307/jones 200/chinese/5
etc
B-405/jones 200/japanese/2
B-405/jones 200/japanese/4
etc
This sample would lead to 2x2x3x25=300 records in "newdata".
A new "sourcedata" table is provided at least daily, then reports from "newdata" are generated which provide tailored timetables.
Suggestions, please, for a method of converting "sourcedata" to "newdata", preferably using action scripting rather than xbasic.
Thanks, Steve Martin
Comment