Best Practice Advice

We have a report that I think is fairly complex. It is not that big, the final version can be about 2 megs. It does have a lot of merge if fields, about 3711 including table, of those 3711, 2143 are merge if fields. The table sections are tables within table, i.e. subtables. We are also using html formatting, table formatting(removing of empty rows), inserting of a image in the header of each document. The report will grow or shrink depending on what data we load in to it. Small record sets will finish very quickly while very large record sets will take 45 seconds to a minute. If we run 3 large reports simultaneously the CPU will go over a 100% and then the transactions will time out. I think I read this somewhere, that the entire dom is rebuilt after a merge IF field is updated, is this true?

My plan is to help fix this is to

  • Remove the IF fields and move that logic into the java code, each field that was a “if” will now have a unique field name in the doc
  • Break the document up from 1 large document to many smaller documents
  • Thread the creation of the smaller documents once those are finished they would then be merged into 1 large documentWe have a report that I think is fairly complex. It is not that big, the final version can be about 2 megs. It does have a lot of merge if fields, about 3711 including table, of those 3711, 2143 are merge if fields. The table sections are tables within table, i.e. subtables. We are also using html formatting, table formatting(removing of empty rows), inserting of a image in the header of each document. The report will grow or shrink depending on what data we load in to it. Small record sets will finish very quickly while very large record sets will take 45 seconds to a minute. If we run 3 large reports simultaneously the CPU will go over a 100% and then the transactions will time out.

Do you have any other advice or best practices that might help?

Hi Tracy,

Thanks for your inquiry.

You are correct that Aspose.Words can partially update certain fields, including IF fields during mail merge. Could you please clarify how you are going to move the logic from IF fields into your Java code?

Your proposal of using threads to work on separate sub documents and then join them sounds good. Please let us know if you have any troubles implementing this.

Thanks,

Thanks Adam for your response and help!

Instead of having each IF field do a compare i.e.
{ IF «QuestParentSchPerfRead_soundingOutWrds» = 1 X * MERGEFORMAT}

I am going to give each field a unique name within the table i.e. {MERGEFIELD DontKnow * MERGEFORMAT } a X should print out at that location. This should allow me to remove the if fields in favor of just a straight mail merge. It seems to me that the IF fields in conjunction with having 1 very large template seems to cause the overall processing to slow.

Hi there,

Thanks for this additional information.

Moving the conditional parts of the document into your application to be handled manually sounds like it could work. Please let us know if you have any troubles and we will be glad to help.

Thanks,