Need group element only on fields that are not empty

Hi again,

Can I put a condition on a group element where it only groups if the selected grouping field is not empty?

Explanation:
Our statement prints each transaction on an invoice as a seperate line. So we’ve grouped these on the @CustTrans_Invoice field to show only one line per invoice. Unfortunately the payment transactions all have this field empty, so now all payments are grouped into one line as well.

I need the grouping to only apply when the field is not empty. Is this possible?

2001 Statement.docx (68.3 KB)

CustAccountStatementExt.Report (37).ddsp (144.1 KB)

Hi Nicky,

You can apply filtering on the group data, so that only the data that matches the filter, gets into the group. In your scenario, you can set the group filter like this:

CustTransLines[@CustTrans_Invoice != ‘’]

Your template would then look like this:

I hope this meets your requirements.

Kind regards,
Albin

Lol oh my gosh, I actually tried that formula, but I used the wrong brackets. Sigh… :slight_smile:

Thanks Albin.

Ok but that excludes the lines where the field is empty completely from the report though?

Hi Nicky,

I implemented the filtering as you asked. As I understand you now, the criteria need to be extended. You probably know how, so you can try implementing it now. You can combine logical expressions “and” and “or” in the criteria within square brackets.

Hi Albin,
I’m not getting any expression to group only the populated Invoice fields but still display the lines where this field is empty.
This seems to me to need an exclusion and I don’t know how to do that.

Hi Nicky,

If you describe what kind of exclusion you need, I can help you create a filter expression.

I need the group element to group by invoice number when the field is populated, and display all lines where the Invoice field is empty.

I have tried a listing element first with a group in the list, I have tried the other way around as well.

So basically I need the lines on the ddsp listed, and grouped if the invoice number field is populated.

Hi Nicky,

Do you need this for the CustAccountStatementExt.report and the DDSP file you have already sent?

Hi Nataša,

That is correct yes.

All lines need to be displayed, but invoices need to be grouped on a single line per invoice number.

Hi @Nicky,

I’d like to clarify something first. So, if you apply the expression:

CustTransLines[@CustTrans_Invoice != ‘’]

to the group, in the preview you’ll get the following result, with the PTIN0000001 line, which is expected, as it is the only unique, non-empty value for CustTrans_Invoice.

Are you expecting a different result or looking to expand/change the criteria for the filtering?

Hi Dalila,

That expression works as expected yes. I get only the one line for invoice PTIN000001, the payment lines are not printed as it’s excluded in the expression.

I need to expand the expression so the payments, where CustTrans_invoice is empty, show as a list, each one on a separate line, along with the grouped invoice line. And that is where I’m stuck.

Hi @Nicky ,

As I understood your requirement, you want to have one unique line per each unique @CustTrans_Invoice where it is not empty and then below just list all the lines where @CustTrans_Invoice is empty. If this is correct can you review my output and tell me if this is what you expect to see (for credit and debit fields I just inserted tagging elements and also didn’t include running total for balance)?

Hi Semir,

Yes this looks perfect. How do I do this?

Hi @Nicky ,

I will attach the template but also share how I implemented it step by step so you understand the approach and the decisions I made.

Looking at the implemented structure let’s go about it from the beginning:

Since you want to list records, not only display unique values, you need to introduce a List tagging element. To have this element show records that belong to a group you need to position this tagging element inside the Group tagging element as we will need its context for listing the records. I quickly removed the Group tagging element, inserted one row below, added the Group tagging element and inserted the List tagging element in the empty row below. So far so good.

Now, you want to list only specific records in this List tagging element, this is why you need to use filter in the binding expression:

CustTransLines[@CustTrans_Invoice = '']

This will ensure that only the records are listed with the condition from the square brackets.

There is however one additional thing to consider, right now there is one extra line under the PTIN00000001 line since the Group tagging element is doing its thing and showing us two groups as there are indeed two unique groups grouped by @CustTrans_Invoice field:

  • @CustTrans_Invoice = 'PTIN00000001'
  • @CustTrains_Invoice = ''

Now you need a way to hide this second group. If you wanted to apply a filter to the Group then it would mess up the List below as we wouldn’t get the records we need. Instead, since we are displaying a row in the table through the row in the designer, we will apply a condition and hide an entire row if a certain condition is met:

CustTransLines/@CustTrans_Invoice != ''

Do test it out and let us know if you would require any additional information or assistance.

2001 Statement_Docentric_edit.docx (69.7 KB)

Thank you Semir. I’m going through the steps now.

You should take tickets like these and have a User story workshop. I’m sure a number of people will learn a lot from it.

Thanks again. :slight_smile:

Loading the below .ddsp as data source messes up the running balance column, and looks like we won’t be able to sort by date for the first column.

CustAccountStatementExt.Report (41).ddsp (160.2 KB)

Hi Nicky,
Please preview the report which you used to generate the CustAccountStatementExt.Report (41).ddsp file using output in Word format. Then arrange this Word document as you want to it to be printed. Send us this Word file and we will see how we could design the template to support it.

Hi Albin,

We found a different work around. It made more sense to change the report dsp to include unique fields for each transaction and design the template around that.

Thank you for your help.

Hi Nicky,
thank you for information.
Have a nice day.