addrbook

Top  Previous  Next

addrbook

book=new("addrbook",name$[,create])

 

Address book object stores delivery records, identified by an entity ID and document type.  Each record is maintained as a string template with the following fields:

 

 entityid$, doctype$, entityname$, contactname$, sendto$, combine.

 

All address books are stored in the addrbks subdirectory under the UnForm server.  The files are named as name$+".dat", so the name must be a valid file name for the operating system.  If the address book exists, it is opened for use.  If not, and the create flag is true (1), it is created.  An error occurs if the address book is not found and the create flag is missing or false (0).

 

Properties

filename$ is a read-only property that contains the actual disk file used to store the address book records.

template$ is a read-only property that can be used to dimension an address entry template.  i.e. dim rec$:book'template$.

 

Methods

count() returns the number of entries in the addressbook.

deladdress(entityid$,doctype$) removes the address book entry.  Returns 1 or 0.

getaddress(entityid$,doctype$,address$) fills address$ template with the requested entry, returns 1 if successful, or 0 for failure.  For example, if there is no record found, a 0 is returned, and address$ will be an empty, but dimensioned, template string.

newaddress(address$) creates an empty address$ template that can be filled by a code block before writing.  Always returns 0.

putaddress(entityid$,doctype$,address$) updates address book using entityid$ and doctype$ identification, writing the data in the template address$.  Returns 1 if successful, or 0 if not.  Note that address.entityid$ and address.doctype$ are set to entityid$ and doctype$.

range$(start,count[,order[,descending]]) returns a LF-delimited list of TAB-delimited records. Each record contains the same fields as the template above, separated by a TAB character.  If start or end are 0, they are the first and last records, respectively.  The optional order value can control the sequence of the records:  0 for entity ID/DocType, 1 for entity name, 2 for contact name, or 3 for send to address.  The optional descending value can be 0 for ascending sequence, 1 for descending sequence.