Page 1 of 1

repeat and condition in one control?

PostPosted: Sat Mar 09, 2013 12:48 am
by ano
Hi,

i have a document that i want to send as a reminder to the customers. The document has a small table with positions and amount of older unpaid invoices followed by a first sum and if the customer already paid some money, there is a second list with position and amount of the paid money and the total sum.

For example
invoice 1 ... 100€
invoice 2 ... 150€
sum so far ... 250€
already paid1 ... 50€
already paid2 ... 35€
total .... 165€

As the design is now, i can't make one list for all positions because of the sum in the middle which is also differently formatted in word so i have two seperate repeats for the invoices and the paid amounts. The design is set!
And as long as i have items in both lists, everything is fine. But when the customer didn't pay anything yet, the second list should be deleted. So i added a condition in the repeat tag around the position and amount and added the necessary stuff in the customxmlpart. the condition works as it should . Is the value false, the table row gets deleted, is the value true, the row stays there. The problem is now: if the condition is true and there are more than one paid item like in the example above, only one item is displayed.

It seems, that the repeat mechanism breaks when the repeat comes with a condition. Normaly the tag with the repeat also changes to something like od:rptd=x7&od:RptInst=2, but also that doesn't happen. It is like the repeat is ignored after the condition is processed correctly.

Is this by design or a bug or a feature? Has anyone encountered this problem an has a workaround.
Of course i can traverse through all sdts, get the condition, follow the mappings, evaluate the value und delete the rows on my own, but i would like to avoid the work, when i can get the opendopehandler to work.

Best regards,
Ano

Re: repeat and condition in one control?

PostPosted: Tue Mar 12, 2013 6:17 pm
by jason
Hi Ano

The code doesn't expect one content control to be both a repeat and a condition. You should wrap your repeat content control in a condition content control, or vice versa.

I hope you can put 2 content controls around a table row. If not, you can make your row into a separate table (in the Word UI, it will still look like one table), and put one of the content controls around the table.

What happens if there are zero items to be repeated? That is supposed to be the same as deleting the repeat content control.

cheers .. Jason

Re: repeat and condition in one control?

PostPosted: Tue Mar 12, 2013 7:43 pm
by ano
Hi,

we make the documents with the software in the beginning. But after that, our customers should be able to change the design of the documents or the static texts/pictures and so on, we can't make the documents to complicated. So your first two ideas may be good but i think we can't do that.

Leaving the data for the second repeat away but inserting the mapping with the xpath is the solution. I even had this idea on friday but i thougt, that if i could just leave out the data the conditions would not make sense anymore so i didn't even try it. My example data had always some data for the second repeat and i only tried to control the output via conditions.

So that's it. Thank you.