Hi,
So you want one record in your custom table to refer to an other custom table item?
Kentico has a default form control for this.
- Create a new field of Data type: GUID
- Choose as form control: 'Custom table item selector'
- insert a Format of the display name. Here you pick the field(s) of the other custom table column you want to display, for instance {%Title%}
- insert the name of the value column (this will be your reference), most likely the default ItemGUID
If you want to get this data from custom code you'll be getting the referenced item based on the ItemGUID, no custom query needed but something along the line of:
CustomTableItemProvider.GetItems(customTableClassName, where, null, topN, columns);
If you really need to fill some extra fields in your new Custom table based on the selection (which actually makes you save your data twice). I'd go with the above solution and create a custom event handler after this record was saved to update some extra none required and not visible/editable fields on-after-insert. But since you'd be storing your data twice I'd go with the first option.
Greets,
David