When using the filenet API to obtain the total number of doucmnt instances, you must note that the root folder (/) is obtained, and whether the document in the unfileddocument is useful must be considered. For example, in a Zhy project, the document under unfileddocument is stored with the file management platform, but it stores the email attachments archived in notes. Simple query operations are as follows:Code(Note the use of pageiterator ).
Public int querytotal (ObjectStore OS, string doctype) {string SQL = "select ID from" + doctype + "d with includesubclasses where D. this insubfolder '/' "; searchsql = new searchsql (SQL); searchscope scope = new searchscope (OS); propertyfilter filter = new propertyfilter (); filterelement ele = new filterelement (null, "ID", null); filter. addincludeproperty (Ele); repositoryrowset rows = scope. fetchrows (searchsql, null, filter, null); iterator iter = rows. iterator (); int COUNT = 0; while (ITER. hasnext () {ITER. next (); count ++;} return count;} public int queryrangeamount (ObjectStore OS, string doctype, date startdate, date enddate) {string SQL = "select ID from" + doctype + "d with your desubclasses where (D. this insubfolder '/') and "+ propertynames. date_created + "> =" + dateformat (startdate) + "and" + propertynames. date_created + "<" + dateformat (enddate); searchsql = new searchsql (SQL); searchscope scope = new searchscope (OS); propertyfilter filter = new propertyfilter (); filterelement ele = new filterelement (null, "ID", null); filter. addincludeproperty (Ele); repositoryrowset rows = scope. fetchrows (searchsql, null, filter, null); iterator iter = rows. iterator (); int COUNT = 0; while (ITER. hasnext () {ITER. next (); count ++;} return count;} private string dateformat (date) {simpledateformat SDF = new simpledateformat ("yyyymmdd"); string datestr = SDF. format (date); SDF = new simpledateformat ("hhmmss"); datestr = datestr + "T" + SDF. format (date) + "Z"; return datestr;} public void testquerytotalbydoctype () {string SQL = "select ID from companydoc d with includesubclasses where D. this insubfolder '/' "; searchsql = new searchsql (SQL); searchscope scope = new searchscope (OS); propertyfilter filter = new propertyfilter (); filterelement ele = new filterelement (null, "ID", null); filter. addincludeproperty (Ele); repositoryrowset rows = scope. fetchrows (searchsql, 1000, filter, true); iterator iter = rows. iterator (); int COUNT = 0; pageiterator = rows. pageiterator (); While (pageiterator. nextpage () {COUNT = count + pageiterator. getelementcount ();} logger.info ("count is:" + count );}