How to create a invoice without items duplicates.

Hi everyone i'm trying to format my invoice word doc to not show repeated items entries. Is it possible to do with a  if expression inside the document? Something like a Unique() expression.

Solved Solved
1 4 317
1 ACCEPTED SOLUTION

Don't iterate across the child records, iterate across a table of items.

Consider these 3 tables:

Order:

id
a

Order_Item

id order_id item_id qty
1 a ddd 5
2 a fff 7

Item

id name
aaa ...
ddd ...
ggg ...
fff ...

Then your template would be like this:

<<START: UNIQUE([related...][item_id])>> 
NAME: <<[item_id].[name]>> 
Total QTY: <<SUM(SELECT(order_item[qty] , AND( [order]=[_THISROW] , [item_id]=[_THISROW-1] ) ) )>>
<<END>>

View solution in original post

4 REPLIES 4
Top Labels in this Space