Database>Creating a New Table - II>Properties>Multi Dimensional Arrays
Caravan Business Server>Help>Database>Creating a New Table - II>
Properties>
Multi Dimensional Arrays
|
Name
|
Multi Dimensional Arrays
|
Text
|
Multi-dimensional array is one of the most powerful and unique features of the Caravan database. While most databases store values in a single dimension, you can use multi-dimensional arrays for storing multiple values in different dimensions. Example: A telephone number can have different dimensions like Home, Office, Mobile, Voice Mail, etc. Thus, with a single field, you can store different telephone number types. An array of field names can be created in a Caravan database.Arrays allow you to refer to a series of field names by the same name and use a number (an index) to tell them apart. All elements in an array have the same data type. In Caravan script, an array of field names is automatically created when one assigns multiple values to a field name.
|
Sample
|
<CARAVAN> table contacts=contacts.contacts contacts(Company)="1" contacts(firstname)="Chris" contacts(lastname)="Johnson" contacts(title)="Manager" //workphone is a multi dimensional field //multiple phone numbers are delimited with coma so set the delimiter to "," contacts(delim)="," contacts(Workphone)="6556412,6556403,6550291" //reset the delimiter contacts(delim)="null" contacts(homephone)="4015264" contacts(mobilephone)="9821124568" contacts(Faxnumber)="6550291" contacts(EmailAddress)="chris@email.com" contacts(contacttype)="2" //insert the record contacts(insert) </CARAVAN> In the example, 3 telephone numbers are inserted in the record.
|
Back
|
|