Find how many time the doc template are used

Hi,

I want to know how many times are my doc template in use.

Can you confirme me that the good way ?

Here my Code

/Search seDocument
SearchEngine seDocument;
//SQL bauen - Suche alle DocTmpl die nicht gelöscht sind
seDocument.bypassNetServer(true);
seDocument.addField("DocTmpl.DocTmpl_id");
seDocument.addField("DocTmpl.name");
seDocument.addCriteria("DocTmpl.deleted", "OperatorEquals", "0", "And", 0);
seDocument.addOrder("DocTmpl.name", true);
for (seDocument.execute(); !seDocument.eof(); seDocument.next())
{
  //für alle Dokument.. prüfen wieviel diesen benutzt sind
  String sDocTmpl_id = seDocument.getField(0);
  String sDocTmpl_name = seDocument.getField(1);
  SearchEngine seDocumentCount;
  seDocumentCount.bypassNetServer(true);
  seDocumentCount.addField("appointment.appointment_id");
  seDocumentCount.addCriteria("appointment.document_id","notequals","0");
	seDocumentCount.addCriteria("appointment.task_idx", "OperatorEquals", sDocTmpl_id);
  output.append(sDocTmpl_name+";"+seDocumentCount.execute().toString()+"\n");
}

Or where can I found them ?

Thanks

Ingen svar så langt