OL Learn

Repeat - New record when value changes

I use the datmapper on a invoice, but can’t get the repeat to work.

The invoice contains multiple sections determined by a project id
It could look something like this:
Page 1 - Project ID: 001 (header)
Data for Project 001
Page 2 - Project ID: 001 (header)
More data for Project 001
Page 3 - Project ID: 001 (header)
more data for Project 001
Page 4 - Project ID: 002
Data for Project 002
Page 5 - Project ID 003
Data for Project 003

I can loop/repeat on the project ID
But if i do that Record 1 contains data from Page 1, record 2 contains data from page 2 etc.
In this case I only want to start a new record if the Project ID changes.
Is that posible ?

Project ID.pdf (133.3 KB)

Set the boundaries settings so that the record changes only when the first part of the project number changes:

So in this case, BLLPR-00124 and BLLPR-00124-001 will both be part of the same record because the BLLPR-00124 prefix is the same.

1 Like

Thanks Phil it did the trick.

An additional quistion…
Now I have 2 records as expected.
Now I need to place data from record 1,listed in one table, data from record 2 listed in another table in the template.
Is that posible, I tried to use the nested tabel wizard, but that only lists the records below each other.
Se picture

I need to have the data info tables like this:
Table1 (record 1) Project Info
Table2 (record 1) AC Info
Table3 (record 1) Order Description
Table4 (record 1) Work Done
Table1 (record 2) Project info
Table2 (record 2) AC Info
Table3 (record 3) Order Description
Table4 (record 4) Work Done
etc.

Well now, that’s different. A document can only use a single record, so in this instance, you will have to make sure your record contains all the information that you want to print on a single document.

Each record can of course have many detail tables, and nested detail tables, which is probably what you are looking for here.

And in my case, I only need one invoice, with multiple projects/sections.
So the approach with page boundaries can’t be used, cause it generates 2 records=2 invoices.
Is there a way to do the same with the repeat function with the use of some scripting?Invoice-Print_Template13_2021.pdf (72.7 KB)