Hello, I just started using Docentric last week. I am editing the SalesInvoice report. I have an ask to show the InvoiceDate if the DocumentDate is empty.
My IIF looks like this…
iif(SalesInvoiceHeader/@DocumentDate = “”,
However, it seems to be trying to display the DocumentDate, even though there is no value for DocumentDate. I even tried to edit the XML for documentDate to see what was populating, or even add a date to see what would return. What is strange, in the XML document, there is no DocumentDate column, there is a SpecialFormattedDocumentDate. In my schema, I can clearly see the option for DocumentDate.
At any rate even adding the DocumentDate as a field, nothing shows up. InvoiceDate does have a value. So I tried to switch the references in the IIF, so if InvoiceDate is blank then show DocumentDate otherwise show InvoiceDate. Although the Xpath results box says its returning InvoiceDate, nothing populates where my if element is placed.
Any help would be greatly appreciated. Thank you!
the DocumentDate field is included in the DDSP XML schema so you can see it in the data source and use it when creating/editing templates.
The reason you can not see it under the report data is because we do not add date/time fields without values, only empty string fields and numeric fields without values appear in the report data.
For your statement to work correctly, you need to format the DocumentDate field into a string and then compare it with empty string (= “”):
iif(string(SalesInvoiceHeader/@DocumentDate) = ‘’,
Thank you! I apologize for the late response.
Another thing I had been doing incorrectly, is when I selected the fields to bring them over, docentric was only bringing in the field name and not the full path of the field.
I had to bring in the full path for it to work, as it shows in your example. e.g. SalesInvoiceHeader/@DocumentDate
Where I had just been showing @DocumentDate in the iif()
Docentric dynamically creates the full path to the field when the field is selected in the dialog below:
However, if you go into the Xpath editor and double-click on the XML elements there, only the name of that element is inserted into the Xpath expression on the right. This is because you are supposed to create custom expressions there:
This means that you need to be more careful to manually enter the full path to this XML element, including, for example, the name(s) of the record or subrecords.
If you have problems with an inline-if expression, I recommend breaking it into simpler parts (multiple tagging elements using only parts of the original expression) so that you can be sure that all parts work (have correct Xpath expressions) before combining them into a final expression.
In your case, I suggest breaking it up as follows: