Database>Inserting records into Relational Database
Caravan Business Server>Help>Database>Inserting records into Relational Database
Text
When inserting data into relational tables, the record number of the master table is inserted into table.
Figure 1
Data input screen HTML code //Company dropdown box
//Contact Type dropdown box
//Data insertion <CARAVAN>table contacts=contacts.contacts // The company field is replaced with the record id of the selected company contacts(Company)=form(txtCompanyID) contacts(firstname)=form(txtfirstname) contacts(lastname)=form(txtlastname) contacts(title)=form(txttitle) //workphone is a multi dimensional field //multiple phone numbers are delimited with coma so set the delimiter to "," contacts(delim)="," contacts(Workphone)=form(txtphone) contacts(delim)="null" contacts(homephone)=form(txthomephone) contacts(mobilephone)=form(txtmobilephone) contacts(Faxnumber)=form(txtfaxnumber) contacts(EmailAddress)=form(txtemailaddress) // The contacttype field is replaced with the record id of the selected contact type contacts(contacttype)=form(txtContactID) //insert the record contacts(insert) </CARAVAN> Data retrieval from relational tables
Data retrieval is automatically taken care of by the Caravan Database Manager. When you open a table related to another table, you can directly access the fields from the mastertable without writing any additional code. Example
<CARAVAN> table contacts = contacts.contacts select from contacts where firstname=john "First Name is ";contacts(firstname);"<br>"
//though company name is a filed in the master table company, the company name for the selected contact //is directly available as if it is a field in the contacts table