I am attempting to create a webmerge between pipedrive and Formstack Documents for an invoice document.  I would like to have a table that list the Product, Qty, Price, Sum, and Notes.  I am having difficulty because of the way Pipedrive passes the data.  Instead of passing like above for multiple products it passes data like below.

$product (Shirt,Pants,Socks)

$qty (1,2,3)

$sum($2,$3,$4)

$notes(note1,note2,note3)

I have successfully been able to complete this task if in my merge document I set the following fields:

{$product1} {$qty1} {$price1} {$sum1}

{$product2} {$qty2} {$price2} {$sum2}

and continue down the document adding another number per row.  The problem with this is I do not know how many products there will be with any given deal.  If I make twenty different rows  and there is only one product then I have 19 blank rows on the document.  If there are 22 products and I only have twenty rows then two products do not show up on the document.

Any help on developing this document would be greatly appreciated.