Merge with regions inside a table inside an if statement produces unexpected results

Hi,

I am trying to create an IF statement like:

{IF "{MERGEFIELD "TEST3A" \* MERGEFORMAT" = "" "" " table here " \* MERGEFORMAT}

If the table contains a merge field and the condition is met, the table seems to go missing even though the field appears.

If the table contains repeating rows, stranger things happen.

The attached csharp project demonstrates this.

Regards,

Doug

Hi

Thanks for your request. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.
Best regards.

Hi,

Just to add, this was originally tested in 7.0.0.0 however it is still present in 8.0.0.0. It is also worse in 8.0.0.0 as the message “Error! Unknown op code for conditional.” appears several times.

Regards,

Doug

Hi

Thank you for additional information. We will notify you once the issue is resolved.
Best regards,

Hi,
I am working on your issues. Most of them are already fixed in the current database. I just wanted to make a remark about the second mail merge region (which is in the table inside the IF field). You see, it will not be populated because only the first region from regions with the same name are populated. This is because the data source interface does not have a way to reset to the first record, and to avoid confusions we have also blocked it programmatically. So it is expected the second region is not populated. But I tried to exclude one of the regions, and then the remaining one was merged correctly, whether or not it was inside a field.
Please expect a new release addressing all of your issues later in December.
Thanks.

The issues you have found earlier (filed as 10962) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(84)

Thanks, these issues have gone away in the latest release.

I am still getting the error “Error! Unknown op code for conditional.”

I have a IF statement in the footer and a table to be merged with data in it

I attached the word template file

Hi

Thanks for your request. The problem occurs because IF field code is incorrect in your case. First of all there should be white spaces before and after a condition operator.
{ IF 1 = 1 "true text" "false text" }
Also, I suppose {PAGE} and {NUMPAGES} in your condition are supposed to be fields, but in your document they are just text. So please correct your document and all will work fine.
Please let me know if you need more assistance, I will be glad to help you.
Best regards.

Hi,

a have a new problem. My condition is
{ IF «MatrizCriteriosCount» > 0 "
Critérios para Avaliação

Valor Sigla Descrição
«TableStart:Criterio»«CriterioValor» «CriterioSigla» «CriterioDescricao»«TableEnd:Criterio»

" "Não existem critérios para esta matriz " * MERGEFORMAT {IF NumberCount > 0 "

" “Not existis”*MERGEFORMAT}

If NumberCount = 1 the condition is true but the mergefilds od the table is not updated.The result is

Hi

Thanks for your request. Please attach your sample template here for testing. I will check the issue and provide you more information.
Best regards.

Hi, this is my sample template.

thifsantonio:
Hi, this is my sample template.

Nothing?

Hi

Thank you for additional information. I cannot reproduce the problem on my side. As I can see all works fine on my side. Here is my test code:

// Create dummy datasource.
DataTable tableMatriz = new DataTable("Matriz");
tableMatriz.Columns.Add("MatrizNome");
tableMatriz.Columns.Add("MatrizEscopo");
for (int i = 0; i <10; i++)
    tableMatriz.Rows.Add(new object[]
    {
        string.Format("MatrizNome_{0}", i), string.Format("MatrizEscopo_{0}", i)
    });
// Open template.
Document doc = new Document(@"Test001\in.docx");
// Fill region with data.
doc.MailMerge.ExecuteWithRegions(tableMatriz);
// Fill mergefield inside IF field.
doc.MailMerge.Execute(new string[]
{
    "ModeloMatrizesTotalCount"
}, new object[]
{
    "1"
});
// Save output document.
doc.Save(@"Test001\out.docx");

Best regards.