library

Top 

library

obj=new("library",libname$[,create])
 

The library object provides extensive access to the documents in a specific library, specified in libname$, including document listings and manipulation of individual document and sub-image properties, as well as general library information.

 

If the libname$ provided is not found, a new library is created if the create field is true (1).

 

The library object enforces library security, and will generate appropriate errors if the active user login (specified with the setlogin() code block function) does not have rights to perform requested operations.

 

Properties

 

All properties are read-only.

 

•datecreated$ is the date the library was created, in yyyymmdd format.
•forceseq is true (1) if sub IDs are auto-sequenced to prevent overwriting.
•inactive is true (1) if the library is locked from further updates.
•lasterrmsg$ contains the last known error message related to methods.
•libname$ is the name supplied to the object.
•pathname$ is the full system path to the library.
•permission$ is the default permission setting for users that do not have specific permissions allocated.  It is a semicolon-delimited list of "r", "w", or "d".
•title$ is the library title, or description.

 

 

Methods


•candelete(userid$)
 
returns true (1) if the specified user can delete images or documents from the library.
 

•canread(userid$)
 
returns true (1) if the specified user can read the library.
 

•canwrite(userid$)
 
returns true (1) if the specified user can write to the library.
 

•catcount()
 
returns the number of category indexes in the library.
 

•copydoc(doctype$,docid$,todoctype$,todocid$[,library$])
 
Copies a document, indentified by doctype$ and docid$, including all its subdocuments, to the specified todoctype$ and todocid$.
 
If library$ is specified, the document is copied to a different library.
 
Returns 1 if successful.
Returns 0, and fills lasterrmsg$, if not.
 

•copysubdoc(doctype$,docid$,subid$,todoctype$,todocid$,tosubid$[,library$])
 
copies a subdocument, indentified by doctype$, docid$, and subid$, including its image data, to the specified todoctype$, todocid$, and tosubid$.  If library$ is specified, the subdocument is copied to a different library.  Returns 1 if successful.  Returns 0, and fills lasterrmsg$, if not.
 

•countcats([seed$])
 
returns the number of category indexes within the given seed.  If no seed$ is provided, a count of initial segments is returned.  If seed$ is provided, the count is the number of segments at the next level.  Seed$ is pipe-delimited.  For example, countcats("Customers|ByName") would return the number of third-level segments within Customers|ByName.
 

•countdocs(doctype$)
 
returns the number of documents in the specified document type.
 

•countdocsbycat(seed$)
 
returns the number of documents for the specified category index, which is in a pipe-delimited segment series format.
 

•countdocsbydate(date$)
 
returns the number of documents for the specified date.  Date$ should be in yyyymmdd format.
 

•deldoc(doctype$,docid$)
 
removes the specified document, and any of the document's sub IDs , from the library.
 

•delsubdoc(doctype$,docid$,subid$)
 
removes the specified subdocument from the library.
 

•doccount()
 
returns the number of documents in the library.
 

•docexists(doctype$,docid$)
 
returns true (1) if the document type and ID exist in the library, false (0) otherwise.
 

•getcats$([seed$[,first|first$[,count[,descending]]]])
 
returns a linefeed delimited list of category indexes found in the library.  Each index has pipe (|) segment delimiters.  If seed$ is provided, the list is returned within the prefix found in seed$, which is a pipe-delimited list of segments.  In this way, it is possible to get a list of indexes, sub-indexes, sub-sub-indexes, and so forth.  The list starts at the record number specified by first, or the sub-segment value specified in first$.  Up to count records are returned.  If descending is true (1), the list produced in descending order.
 

•getcats$()
 
returns a list of initial category segments.
 

•getcats$("Customers")
 
returns a list of second segments within the "Customers" initial segment.
 

•getcats$("Customers|ByName","B",1000)
 
returns a list of up to 1000 category indexes within the Customers, ByName seed, listing values of the third segment, starting with "B".
 

•getdates$()
 
returns a linefeed delimited list of document dates found in the library.  Dates are returned in yyyymmdd format.
 

•getdoc(doctype$,docid$,doc$)
 
fills the doc$ property template with document properties, and returns 1 if successful.  The template contains the following fields:
 
 date$ (yyyymmdd)
 time$ (hhmmss)
 dateupdated$
 timeupdated$
 title$
 entityid$
 notes$
 keywords$
 categories$
 links$
 

•getimage(doctype$,docid$,subid$,filename$)
 
extracts the image data to the specified filename$.  If filename$ is null, then a temporary file is generated with an appropriate extension and returned in filename$.  The temporary file is automatically deleted with the job is complete.  A user-supplied file name is not deleted.  Returns 1 if successful.  If not successful, lasterrmsg$ will contain an error message.
 

•getrange$(doctype$,first|first$,count[,descending[,delim$]])
 
returns a linefeed delimited list of document types and IDs within the specified document type.  The list starts at the record number specified by first, or the document ID specified by first$.  Up to count records are returned.  If descending is true (1), then the list is returned in descending order.  If delim$ is specified, the type and ID are delimited by that character.  If no delim$ is specified, then they are delimited by a tab ($09$).
 

•getrange$(first,count[,order[,descending[,delim$]]])
 
returns a linefeed ($0A$) delimited list of document types and IDs.  The list range is in sequence based on the value of order: 0=type/ID, 1=date/time created, 2=title.  The range is specified with first and count, indicating the starting document, and the maximum number to return.  If descending is true (1), then the list is returned in descending order.  If delim$ is specified, the type and ID are delimited by that character.  If no delim$ is specified, then they are delimited by a tab ($09$).
 

•getrangebycat$(seed$,first,count[,descending[,delim$]])
 
returns a linefeed delimited list of document types, IDs, and category indexes, in category index order, within the specified seed, which is provided as pipe-delimited segments.  The list starts at the record number specified by first.  Up to count records are returned.  If descending is true (1), then the list is returned in descending order.  If delim$ is specified, the type, ID, and category index are delimited by that character.  If no delim$ is specified, then they are delimited by a tab ($09$).
 

•getrangebydate$(date$,first|first$,count[,descending[,delim$]])
 
returns a linefeed delimited list of document types, IDs, and date/times, in date/time sequence, within the specified date, which is provided in yyyymmdd format.  The list starts at the record number specified by first, or the time specified by first$ (in hhmmss format, 24 hour clock).  Up to count records are returned.  If descending is true (1), then the list is returned in descending order.  If delim$ is specified, the type, ID, and date/time are delimited by that character.  If no delim$ is specified, then they are delimited by a tab ($09$).
 

•getsubdoc(doctype$,docid$,subid$,subdoc$)
 
fills the subdoc$ property template with subdocument properties, and returns a 1 if successful.  You can reference properties as subdoc.title$, subdoc.date$, subdoc.time$, subdoc.type$, and subdoc.size.
 

•getsubids$(doctype$,docid$)
 
returns a linefeed ($0A$) delimited list of sub IDs on file for the given document.
 

•gettypes$()
 
returns a linefeed delimited list of document types found in the library.
 

•imgcount()
 
returns the number of images (sub IDs) in the library.
 

•movenext(doctype$,docid$[,docprop$])
 
returns information about the next document in sequence.  Doctype$, docid$, and if supplied, the docprop$ document properties template, are filled.  See the getdoc() method for information about fields in docprop$.  The method returns 1 if successful, or 0 otherwise (such as an end of file error).  The starting position of a series of move commands can be set with the moveto() method.
 

•movenextcat(categories$,doctype$,docid$[,docprop$])
 
returns information about the next category and its associated document in sequence.  Categories$, doctype$, docid$, and if supplied, the docprop$ document properties template, are filled.  Categories$ is filled with a pipe-delimited list of category segments.  See the getdoc() method for information about fields in docprop$.  The method returns 1 if successful, or 0 otherwise (such as an end of file error).  The starting position of a series of category move commands can be set with the movetocat() method.
 

•moveprev(doctype$,docid$[,docprop$])
 
returns information about the previous document in sequence.  Doctype$, docid$, and if supplied, the docprop$ document properties template, are filled.  See the getdoc() method for information about fields in docprop$.  The method returns 1 if successful, or 0 otherwise (such as an end of file error).  The starting position of a series of move commands can be set with the moveto() method.
 

•moveprevcat(categories$,doctype$,docid$[,docprop$])
 
returns information about the previous category and its associated document in sequence.  Categories$, doctype$, docid$, and if supplied, the docprop$ document properties template, are filled.  Categories$ is filled with a pipe-delimited list of category segments.  See the getdoc() method for information about fields in docprop$.  The method returns 1 if successful, or 0 otherwise (such as an end of file error).  The starting position of a series of category move commands can be set with the movetocat() method.
 

•moveto(doctype$[,docid$)
 
seeds the next movenext or moveprev methods to the position specified by doctype$ and docid$.  To seed to the start of the library, provide a doctype$ of null.  To seed to the end, provide a high doctype$, such as $ff$.  Likewise, to seed to the end of a given document type, seed the docid$ with a high value like $ff$.
 

•movetodate(ymd$[,hms$])
 
seeds the next movenext or moveprev to navigate the library in date/time order, beginning at the supplied date and optional time.  The date must be in yyyymmdd format, such as "20091231".  If the time is supplied, it must be in hhmmss format using a 24-hour clock, such as "150000" for 3:00 PM.
 

•movetocat(seed$)
 
seeds the next movenextcat or moveprevcat methods to an index position.  Seed$ must be provided as a series of pipe-delimited category segments, such as "Vendors|000999|PurchaseOrders".
 

•newdoc(doc$)
 
fills an empty document property template as doc$.
 
The property template contains the following fields:
 

date$ (yyyymmdd format)

time$ (hhmms format, 24-hour clock)

entityid$

notes$

keywords$ (semicolon-delimited keyword list

categories$ (semicolon-delimited list of pipe-delimited indexes)

links$ (semicolon-delimited list of links)
 


•newsubdoc(subdoc$)
 
fills an empty subdoc property template as subdoc$.
 
The property template contains the following fields:
 

title$

date$ (yyyymmdd format)

time$ (hhmmss format, 24-hour clock)

type$ (extension of uploaded file)

size
 


•putdoc(doctype$,docid$,doc$)
 
updates the specified document properties.  If the document does not exist, it will be added.  Note that this method does not add any image files to the library.
 

•putsubdoc(doctype$,docid$,subid$,subdoc$[,filename$])
 
updates subdocument properties, and updates the image file as well, if filename$ is supplied.  If the specified subdocument does not exist, it is added.
 

•subdocexists(doctype$,docid$,subid$)
 
returns true (1) if the document type, ID, and sub ID exist in the library, false (0) otherwise.