We’ve developed some resources to help you work effectively from home during COVID-19 Click to learn more

Problem to get how many times a Doc Template is used

Hi,

I have an 500 Error wenn I execute my code and I don't know why.

Could you help me to fin my mistake ? 

Thanks

#setLanguageLevel 3;

printLine("Content-Type: application/csv");
printLine("Content-Disposition: attachment;filename=myfilename.csv");
printLine("");

String output = "Name;benutzt\n";

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");
  
}

printLine(output);

RE: Problem to get how many times a Doc Template is used

Hi,

It works on my installation. You should trace the execution on your installation to see why it fails.

Sverre

Av: Sverre Hjelm 20. nov 2019

RE: Problem to get how many times a Doc Template is used

Hi Sverre,

sorry but I can't trace the execution.. it write 0

Av: Fabrice Reithinger 20. nov 2019

RE: Problem to get how many times a Doc Template is used

Are you able to debug it? What happens if you execute it in the "Edit script" screen?

Sverre

Av: Sverre Hjelm 20. nov 2019