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! Go to 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>>
User | Count |
---|---|
18 | |
9 | |
8 | |
5 | |
5 |