OK, you need to use sourcefiles:{} in each instance.
And you can also skip using theOriginalData if you follow up changes to theData like this:
if bTableView's numberOfRows() = 0 then
set sourcefiles of item actualSelectedRow of my theData to {{filename:"somefile", filePath:"pathtofile"}}
set my theData to my theData -- registers change
In fact, this lets you do away with that whole test, replaced by:
set end of sourcefiles of item actualSelectedRow of my theData to {filename:"somefile", filePath:"pathtofile"}
set my theData to my theData
You can also set the selection in table 1 like this:
set x to current application's class "NSIndexSet"'s indexSetWithIndex_(setSelection)
aTableView's selectRowIndexes_byExtendingSelection_(x, false)
Hmmm, doing it that way you also need to trap for for when there’s no selection in table 1 and someone hits Add for table 2. So maybe:
if actualSelectedRow > 0 then
set end of sourcefiles of item actualSelectedRow of my theData to {filename:"somefile", filePath:"pathtofile"}
set my theData to my theData
set x to current application's class "NSIndexSet"'s |indexSetWithIndex_|(setSelection)
aTableView's selectRowIndexes_byExtendingSelection_(x, false)
end if
And you need to capitalize the “P” in filePath in your binding of the second column of the second table.
You were so close…