Thank you very much for actively help on my issue. I am using java language, there is no such method as intvalue.ToString() to format a integer number to specified format, especially the format is following MS Word specification.
Regarding XplornetInvoiceTemplate.doc, you don’t need to take care of it, I just want to show you our customer how to use formatted number in their template.
I have one question about the FieldIf. I would like to know if there are util classes that can help to evaluate the condition part of a if field. With a if field, we can get the LeftExpression, the RightExpression and operator, but all of them are strings. We don’t know it is true or false of the result of the condition.
Because the thread is too long, I’d like to repeat our requirements again.
For #1 scenario, we expect all the fields are merged according to the format defined in the template, no matter where they are located, so each field is validated with our predefined data;
For #2 scenario, we expect a way to get all the fields which should be merged but not. namely, the fields that don’t meet IF condition should be excluded;
You can use getTrueText() and getFalseText() properties of FieldIf for the purpose. We are further looking into your requirements and will update you with our findings soon.
getTrueText() and getFalseText() is not enough for me. They always return the same value no matter what the condition is evaluated. For example, the following IF expression, getTrueText() always return «Invoice.InvoiceNumber» and getFalseText() always return «Invoice.Amount» no matter what the value of Account.Currency is. {IF «Account.Currency» = USD «Invoice.InvoiceNumber» «Invoice.Amount»}
I am wondering is you have any util class can help to evaluate “«Account.Currency» = USD”, that may help. If the evaluate result is true, I know «Invoice.InvoiceNumber» should be merged; otherwise I know «Invoice.Amount» should be merged.
@tilal.ahmad
I would like to do that, but the left expression and right expression are both String, I don’t know its exact type, it is complex to compare them. That is why I asked if you have any util class I can leverage.
Thanks for your feedback. We think there should not be any issue in string comparison. As both properties return string value, so you can use equal() method form String class to compare strings.
@tilal.ahmad
Thanks a lot for continuing helping on this case. The string comparison with equals() is not enough for us. The operator of FieldIf can be “=”, it is also maybe “<”, “>”, in those cases, we need to know the exact type of the field for comparison.
@tilal.ahmad
As I said in previous reply, to calculate the value of IF condition, we need to know the data type of left express and right express and the operator. But the FieldIF doesn’t provide the data type information, which makes the comparison of left expression and right expression difficult and fallible. For example, if the left express is 11, right expression is 9, the operator is >. When compared as number, then the IF condition is true; if compared as string, then the IF condition is false.
Do you have any suggestion on this situation?
Thanks for sharing additional information. We have logged a ticket WORDSNET-15903 in our issue tracking system for further investigation to evaluate IF condition. We will keep you updated about the issue resolution progress within this forum thread.
Thanks for your inquiry. I am afraid we can not share any ETA at the moment. As we have recently logged the issue and it is pending for analysis in the queue with other issues. We will notify you as soon as some update is available.
We added the FieldIf.EvaluateCondition() method as per WORDSNET-15903 that enables you to evaluate IF condition. Since the ComparisonOperator, LeftExpression and RightExpression properties of FieldIf did not fulfill your requirements, we had introduced the FieldIf.EvaluateCondition() method that immediately returns the result of expression’s evaluation. Sample usage code is as follows:
DocumentBuilder builder = new DocumentBuilder();
FieldIf field = (FieldIf)builder.InsertField("IF 1 = 1", null);
FieldIfComparisonResult actualResult = field.EvaluateCondition();
Assert.AreEqual(FieldIfComparisonResult.True, actualResult);