I have a Holder.ABN and Holder.ACN two string fields.
How to do the check, if both are empty string, then output ‘N/A’
I tried this, but it is not working.
<<if [Holder.ABN != “”] && [Holder.ACN != “”] >>
N/A
<< / if>>
(I have added extra space here to make close if tag visible in forum)
There are two issues:
‘&&’ is not supported?
ABN could be a number, then it cannot compare with “”.
In case you are using old version of Aspose.Words, we suggest you please upgrade to the latest version of Aspose.Words for .NET 20.2.
If you still face problem, please attach the following resources here for testing:
Your input Word document.
Please attach the output Word file that shows the undesired behavior.
Please attach the expected output Word file that shows the desired behavior.
Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.
As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.
PS: To attach these resources, please zip and upload them.
input word document ‘test.docx’ in \bin\Debug folder
output word, nothing because throw error ''An error has been encountered at the end of expression ‘Holder.ABN != “”] ‘. Can not apply operator ‘!=’ to operands of type ‘System.Nullable`1[System.Int32]’ and ‘System.String’.’’
expected output word, if no error, then the output is what I want
standalone console application, included in the .zip
We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-19979. You will be notified via this forum thread once this issue is resolved.
We try our best to deal with every customer request in a timely fashion, we unfortunately cannot guarantee a delivery date to every customer issue. We work on issues on a first come, first served basis. We feel this is the fairest and most appropriate way to satisfy the needs of the majority of our customers.
Currently, your issue is pending for analysis and is in the queue. Once we complete the analysis of your issue, we will then be able to provide you an estimate.
Please use the latest version of Aspose.Words for .NET 20.6 and set JsonDataLoadOptions.SimpleValueParseMode to JsonSimpleValueParseMode.Strict as shown below to get the desired output.
private static void GenerateAsposeDocument(string templateName, string jsonPayload)
{
var doc = new Document(templateName);
JsonDataLoadOptions options = new JsonDataLoadOptions();
options.SimpleValueParseMode = JsonSimpleValueParseMode.Strict;
var dataStream = new MemoryStream(Encoding.ASCII.GetBytes(jsonPayload));
var jsonDataSource = new JsonDataSource(dataStream, options);
var engine = new ReportingEngine();
engine.BuildReport(doc, jsonDataSource);
// Save the finished document to disk.
doc.Save(MyDir + "20.6.docx");
}
I have tried with the latest v20.6 and the ParseMode as you said.
But it still does not work.
The current error is
'An error has been encountered at the end of expression 'Holder.ABN != “”] ‘. Can not apply operator ‘!=’ to operands of type ‘System.Nullable`1[System.Int32]’ and ‘System.String’.’
It is to inform you that the issue which you are facing is actually not a bug in Aspose.Words. So, we have closed this issue (WORDSNET-20594) as ‘Not a Bug’.
Please use the following 'if' tag syntax to get the desired output. We have attached the modified input document with this post for your kind reference. LinqTest.zip (9.3 KB)