Addrbook object

Top 

addrbook

book=new("addrbook",name$)

 

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, it is created.

 

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) 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.