2 conditions to display the field and hide if conditions are not met

I created a condition where the applied discount needs to be shown only if 2 conditions are met:

  1. Rebate Calculation = No
  2. Line Discount value = Not blank

Please show me what I did wrong for the condition I created
image

SalesInvoiceHeader/ExcludeInRebateCalculation = “No”
and
SalesInvoiceHeader/LineDiscount !=" "

Element tree:
image

If all conditions are met
image

Thank you

Hi Soren,

Syntactically your expression seems correct. The issue may be in the context or data source.

You can send us the template and the DDSP file to support@docentric.com so that we get the whole picture and suggest the solution.

Hi Albin,

Thanks for the feedback. Would you have any templates I can refer to with the same syntax? Thank you.

Hello Soren,

I’m not sure if it’s the most applicable to your case, but there’s a very similar syntax in the AgreementConfirmation.Report replica.

In case you don’t already have the replicas, here’s a link for them.

Hope this helps!

Hi Nenad, thanks for your reply. It seems I’m missing the label tagging. However, I tried adding it to the report but seems still not working. I’m still checking further what I may have missed.

Hi @Soren890,

Could you add two new field tagging elements to the template?

One should be bound to “SalesInvoiceHeader/ExcludeInRebateCalculation” and the other to “SalesInvoiceHeader/LineDiscount.”

image

After that, please check for any errors in the field tagging elements and let me know what values are returned. I noticed that the ‘@’ symbol is missing in the data field values, so it should be:

“SalesInvoiceHeader/@ExcludeInRebateCalculation
“SalesInvoiceHeader/@LineDiscount

Alternatively, instead of using the IF tagging element, you could add a field tagging element with the following XPath expression:

iif(SalesInvoiceHeader/@ExcludeInRebateCalculation = ‘No’ and SalesInvoiceHeader/@LineDiscount = ‘’ , ‘Discout’, ‘’)

Hi @AmirO template is still not working. The “Discount” is still displayed even if there should be no values. If the conditions are not met, the word “Discount” should not also be shown in the report. I also tried writing it inside a table but still not working. Any suggestion is appreciated. I can’t share the report because of privacy restrictions.

Hi @Soren890,

I’ve prepared the test template for you, which is attached.

TestTemplate.docx (80.1 KB)

Please load your DDSP file into it and send me a screenshot of the results, ensuring that everything is visible, including the element tree.

Just like in my image:

Hi Amir,
Apologies, there are no warnings when I loaded my DDSP file. In the same word file, I just loaded my DDSP file then no logs.
I could be missing something very simple but for some unknown reason, the supposed to be header still shows even if it do not fit the condition.
Apologies for the rant, this is a bit of pain.

Hi @Soren890,

Could you please click the preview button in the designer to open the template and send me a screenshot?

There’s no sensitive data involved, but it will help me understand everything better.

Hi Amir,

Please see images below.

  1. No line discount

  2. With line discount

Thank you

Hi @Soren890,

Based on this template, you could use either the tagging element or the field tagging element with the following XPath expression:

If tagging element

SalesInvoiceHeader/@ExcludeInRebateCalculation = ‘No’ and SalesInvoiceHeader/@LineDiscount != ‘’

Field tagging element

iif(SalesInvoiceHeader/@ExcludeInRebateCalculation = ‘No’ and SalesInvoiceHeader/@LineDiscount != ‘’, ‘Discount’, ‘’)

I have also prepared a test template. Please try importing your DDSP file to confirm that everything is working as expected.

TestTemplate_2element.docx (79.0 KB)

Hi Amir,

Just tested this and it is working perfectly! Now, I can’t find the cause of my issue because I think I had the same condition written.

Results:
Without line discount
image

With line discount
image

My previous condition:

SalesInvoiceHeader/@ExcludeInRebateCalculation = "No"
and
SalesInvoiceHeader/@LineDiscount = "No"

Some great work here, Amir.

`

Hi @Soren890,

Great to see that we managed to solve this issue.

I didn’t analyze your previous XPath expression, but from what I see in the latest one, the second part of the expression is incorrect. It should be SalesInvoiceHeader/@LineDiscount != ''.

Hope this helps!

Hi Amir,

You’ve been very helpful. Thanks for putting up with me and please be patient as I just started working with Docentric. You guys might receive more inquiries from me in the next days.

Cheers

Hi @Soren890,

No problem, happy to help! If you have more questions, feel free to ask.

Since it was hard to find the issue without the data source, in cases like this, it would be best if you could provide us with the template and DDSP file over support email. This will help both of us find and resolve the issue faster and more efficiently, but no matter what, we’ll do our best to assist you!

Cheers,
@AmirO