Conditional logic- if statements in Word Mail Merge

Is conditional logic supported yet? If not, how far off is this feature? This is a critical feature.
Thanks,
Mark

Hi

Thanks for your request. Unfortunately, conditional logic is not supported yet. This feature will be implemented in one of the future releases. But I can’t tell you exact date.

Also, you can try to move your conditional logic into the SQL query or into the program code.

Best regards.

Unfortunately, moving the logic is not an option, as our end-users/customers need to be able to alter the documents and they cannot code. This issue has been floating around, as far as I can tell from the forums, for 3+ years now. Each time it is mentioned, the response is that it will be implemented, but that has not happened yet. Would it be possible to escalate the implementation of conditional logic? In my opinion, it would be a much more useful feature than some of the other enhancements that have been going on. Of course, I’m biased here.

Hi
This issue is present in our defect base. But we can’t implement this feature yet.
Best regards.

Amen. This is a critical feature to those that are already automated. I might add those already automated are more likely to use Aspose to complete the cycle – seems like a highly desirable feature to those of us already on a ‘bleeding edge’ that MS has as of yet not addressed well (the gap Aspose fills – server based automation). The product works well for what it does, but this is critical to a sophicticated user base already leveraging higher end Word functions.

Thanks. We realize it is important. The only problem is that we have maybe a dozen or so equally important features to work on. Just bear with us, it will all come out right.

We are looking at Aspose as a more robust and complete solution for implementing document creation in our software. We already have a solution in place that uses MS Word. This feature is critical for us to move forward. We are very disappointed to have to find a work around for this functionality.

Hi
As workaround you can try to move your conditional logic into the SQL query or into the program code.
Best regards.

Once again that is not really a valid work around for many. Please bump the priority on this feature as it has been requested by several people over the past few years, and is a critical feature.

Maybe you want to have a look at my blog http://le-raid.spaces.live.com/ where I am writing articles about how to implement it yourself with Aspose.Words.
It’s not too hard to do, if you can afford the time…
Pascal.

FYI, it is possible to implement this, but more difficult than you might expect.

I encountered difficulty in the area of emulating Word’s handling of nested if statements that nullified to become part of the result of the parent if statements result…in other words, you might end up with empty paragraphs where you don’t want them in highly complex nested conditional statements. Ultimately, with some tweaking, these issues can be resolved.

Also, Aspose’s handling of formatting switches in merge fields is limitted at best. It is possible to implement this as well.

Other considerations were implementing formula field and compare field evaluation. However, this was not difficult having already set up an OO heirarchy for field evaluation via regular expressions.

You might find it worthwhile to create an “IfEx” statement that expands upon Word’s limited conditional evaluation ability. We ended up re-wrtiting our most complicated templates (with many many levels of nested conditionals) using this.

Good luck.

I’ve seen no recent posts on this topic - i.e. Aspose not being able to handle merge codes with conditional logic. Have Aspose released a fix for this issue or plan to implement a solution during 2008?

Hi
Thanks for your interest in Aspose.Words. Unfortunately this feature is not available yet. Please see FAQ for more information.
Best regards.

I have been requesting this feature as well for over 2 years. The response has always been the same, it’s coming. I agree with others, all of the features released in the last couple of years are of no use to me.
PLEASE help us ALL.

Hi
Thanks for your inquiry. Unfortunately I can’t provide you any more information about status of this issue.
Best regards.

I want to add my voice to the chorus here. The first notice on this thread was 2006. This is a potential customer speaking: “THERE IS NO MORE CRITICAL ISSUE TO WIDER ACCEPTANCE OF YOUR PRODUCT.” We have a large system for processing settlement letters for the debt industry. We are looking at producing tens of thousands of letters. We can’t use Word because Microsoft won’t give us the time of day for running automation on a server (I hope other people appreciate the irony of Automation that isn’t supported in an unattended environment).
Conditional logic just isn’t an option for the database. I’m not sure why you keep bringing it up like it was a viable work-around. The real power of this paradigm is to let the hundreds of companies that will be using a document processing system like this generate their own letters and use our database to produce the merged fields.
You have an amazing product here. I spent two weeks working on getting Access to create a database in a temporary directory, having Word open that and merge it with a template and save it to a PDF. Another week trying to get it to run as a Service under Windows Server 2008. I was able to do all that in five lines of code with Aspose without having to hit the disk. I would have purchase an EOM license on the spot if you’d been able to perform the ‘IF’ logic. You are on the one yard line here. What possible reason could you have for not going that extra yard?

Hi

Thank you for your interest in Aspose.Words. IF fields evaluation is very complicated task. We are going to support IF evaluation somewhere in the second half of this year or in the beginning of the next one, unfortunately, I cannot give you any reliable estimate at the moment. There is an issue #37 in our defect database regarding this.
Best regards.

You originally Posted this in 2007, that was two years ago:
Hi

Thank you for your interest in Aspose.Words. IF fields evaluation is very complicated task. We are going to support IF evaluation somewhere in the second half of this year or in the beginning of the next one, unfortunately, I cannot give you any reliable estimate at the moment. There is an issue #37 in our defect database regarding this.
Best regards.

Alexey Noskov
Developer/Technical Support
Aspose Auckland Team
Alexey, I’m an engineer also. I know that it doesn’t take two years to write an expression evaluator. The only explaination is that Aspose doesn’t believe this is an important feature. Your web site turns up 87 entries related to ‘If Conditional Logic’. This thread has 2,513 hits. How can we convince you that this is an important feature for your current and potential user base? You could have written the logic in the time it takes to answer all these posts (though I suppose you could save time by having a form letter that you post in response to certain questions).

You are right, the estimate was pushed several times due to the task complexity and other important feature we had to work on. In 2007, the highest priority had out Rendering Engine (released in the end of 2008). We understand that evaluating of IF conditionals is very important feature. Now, when our Rendering Engine is already implemented, Field Evaluation is the next global task in the priority list.

Best regards.

Can you help me out with a practical work-around. I understand the object model for the most part. Here’s some code I found for processing a simple confitional:

//Get collection of field starts
NodeCollection starts = document.GetChildNodes(NodeType.FieldStart, true);
//Loop through all field starts
foreach (FieldStart start in starts)
{
    //Check whether current FieldStart is start of IF field
    if (start.FieldType == FieldType.FieldIf)
    {
        //Field code is represented by content between Field Start and FieldSeparator
        string fieldCode = string.Empty;
        Node currentNode = start.NextSibling;
        while (currentNode.NodeType != NodeType.FieldSeparator)
        {
            Run fieldPart = currentNode as Run;
            if (fieldPart != null)
                fieldCode += fieldPart.Text;
            //Move to next node
            currentNode = currentNode.NextSibling;
            //Break loop if current node is null
            if (currentNode == null)
                break;
        }
        //Here you should evaluate conditional expression.
        //..............................
        //And execute your logic.
    }
}

I can likely work out which statement I want given these tags. Can you please direct me to some code that will show me how to replace my ‘If’ Field with the selected MergeField from the statement?