How's that again?
I find your post very confusing. is JobID the primary key for Table 1 or Table 2?
Does layout setup for your layout refer to table 1 or table 2?
Does portal setup for your portal refer to table 1 or table 2? (you seem to have indicated that both layout and portal are based on table 2--which is very unlikely and would only work with two table occurrences of table 2.)
And does your script reference records in table 1 or table 2? (The steps simply refer to "table"...)