Autofill Data using Master/Detail Key on Row Rendered

Tips submitted by ASPMaker users

Autofill Data using Master/Detail Key on Row Rendered

Postby xgis » Thu Mar 07, 2013 9:56 am

If you have created Master/Detail relationships based on Parent Key Foreign Key relationships you can use AutoFill to automatically transfer required values from the Master Table to the detail table. Generally this occurs by default for a single record transferring of an Integer from the Master Table to the Detail Table so a link can be established. Before doing this ensure you have valid referential relationships established in your database.

In this example there is an AutoFill value which is a GUID, which is the second unique Primary Key for the Master Table. The Row Rendered event can be used to prefill this value into the details table. The following code as provided by ASP Support; The two Unique ID's are SiteID and GUID.

If <SiteIDField>.SessionValue <> "" Then ' Detail add
<GUIDField>.EditValue = ew_ExecuteScalar("SELECT <GUIDField> FROM <MasterTable> WHERE <SiteIDField> = " & <SiteIDField>.SessionValue)
End If
xgis
 
Posts: 83
Joined: Thu Jan 17, 2013 10:40 pm

Re: Autofill Data using Master/Detail Key on Row Rendered

Postby crash » Mon Dec 26, 2016 3:56 pm

Hi Xgis

Thanks for this
I know this is an old post. Question
What if you not user a Master table, ie simply two tables
I want to do what you have described here that is to Auto insert a field from the Users table.
The two tables have the same unique ID.

ie in table 1 I have th field Name.. and in table two also Name
I want Name to insert automatically without editing that field in the second table.

Can you help?
Many Thanks again for the tip
crash
 
Posts: 100
Joined: Tue Nov 27, 2012 5:47 pm


Return to User Submitted Tips (ASPMaker)