I am trying to generate random outputs into OUTPUT TABLE 1 and OUTPUT TABLE 2 of the ITEM column.
There will be options to select from drop downs in the OPTIONS TO SELECT table of TYPE, LEVEL and LOCATION.
Output Tables 1 and 2 then get automatically populated with these chosen options in their respective columns.
The ITEM column of these tables should then randomly select a row from the Reference Table where it finds a match for criteria of ‘Cat.’, ‘Type’, ‘Lev.’, and ‘Loc.’
Of course, more than one match maybe be found and so one option needs to be randomly selected. There are situations where no matches will be found and so that result needs to be left blank in the ITEMS column of each table. There will also be situations where only one option will be found and so, that option would be selected by default.
Rows that have an ‘n’ in the ‘Act.’ Column of the Reference Table should be ignored.
It would be greatly appreciated if someone can point me in the right direction to find a solution to this problem. Thanks in advance, Dan.
There will be options to select from drop downs in the OPTIONS TO SELECT table of TYPE, LEVEL and LOCATION.
Output Tables 1 and 2 then get automatically populated with these chosen options in their respective columns.
The ITEM column of these tables should then randomly select a row from the Reference Table where it finds a match for criteria of ‘Cat.’, ‘Type’, ‘Lev.’, and ‘Loc.’
Of course, more than one match maybe be found and so one option needs to be randomly selected. There are situations where no matches will be found and so that result needs to be left blank in the ITEMS column of each table. There will also be situations where only one option will be found and so, that option would be selected by default.
Rows that have an ‘n’ in the ‘Act.’ Column of the Reference Table should be ignored.
It would be greatly appreciated if someone can point me in the right direction to find a solution to this problem. Thanks in advance, Dan.
Options To Select | |
Type | STR |
Level | 2 |
Location | F |
Output Table 1 | |||||
Cat. | Type | Lev. | Loc. | Item | |
CR | STR | 2 | F | 12 | |
CPD | STR | 2 | F | 2 | |
PSU | STR | 2 | F | 30 | |
PLU | STR | 2 | F | 21 | Only option available and so it chooses it |
Output Table 2 | |||||
Cat. | Type | Lev. | Loc. | Item | |
CR | MOB | 2 | H | 16 | |
CPD | MOB | 2 | H | 6 | Only option available and so it chooses it |
PSU | MOB | 2 | H | 35 | |
PLU | MOB | 2 | H | 24 | Only option available as other option is NON active ('n' in 'Act.' Column), and so it chooses it |
Reference Table | Loc. | ||||||
Area | Cat. | Type | Lev. | H | F | Act. | Item |
CPD | CPD | STR | 2 | y | 1 | ||
CPD | CPD | STR | 2 | y | y | 2 | |
CPD | CPD | FLX | 1 | 3 | |||
CPD | CPD | FLX | 2 | y | n | 4 | |
CPD | CPD | MOB | 1 | y | 5 | ||
CPD | CPD | MOB | 2 | y | y | 6 | |
CPD | CPD | SK | 2 | y | 7 | ||
CPD | CPD | SK | 2 | n | 8 | ||
CPD | CPD | STR | 2 | y | 9 | ||
CR | CR | STR | 1 | y | y | 10 | |
CR | CR | STR | 2 | y | 11 | ||
CR | CR | STR | 2 | y | y | 12 | |
CR | CR | FLX | 2 | 13 | |||
CR | CR | FLX | 1 | y | y | 14 | |
CR | CR | MOB | 2 | y | 15 | ||
CR | CR | MOB | 2 | y | 16 | ||
CR | CR | MOB | 1 | y | 17 | ||
CR | CR | SK | 2 | y | y | 18 | |
CR | CR | SK | 2 | y | y | n | 19 |
UB | PLU | STR | 1 | y | 20 | ||
UB | PLU | STR | 2 | y | y | 21 | |
UB | PLU | FLX | 2 | 22 | |||
UB | PLU | FLX | 1 | y | 23 | ||
UB | PLU | MOB | 2 | y | y | 24 | |
UB | PLU | MOB | 2 | y | n | 25 | |
UB | PLU | SK | 1 | y | 26 | ||
UB | PLU | SK | 2 | y | 27 | ||
UB | PSU | STR | 1 | y | 28 | ||
UB | PSU | STR | 2 | y | y | 29 | |
UB | PSU | STR | 2 | y | 30 | ||
UB | PSU | FLX | 2 | y | n | 31 | |
UB | PSU | FLX | 2 | y | y | 32 | |
UB | PSU | MOB | 1 | y | 33 | ||
UB | PSU | MOB | 2 | y | y | 34 | |
UB | PSU | MOB | 2 | y | 35 | ||
UB | PSU | SK | 2 | y | 36 | ||
UB | PSU | SK | 2 | y | y | n | 37 |