I’m trying to create a report with nested regions and am having some serious trouble with it. The data is being generated by a SQL Stored procedure, and being read out of a byte array generated by Linq to SQL. Everything there is fine and I have several other reports which do the same thing flawlessly. This one however, I just can’t seem to get. Without too much more rambling, here’s what I have.
Data is returned as:
Item1 Name - Item1 Property1 - Value
Item1 Name - Item1 Property2 - Value
Item2 Name - Item2 Property1 - Value … and so on.
What I want the report to look like:
Item1 Name
Table with 2 columns - Property - Value
Property2 - Value
Property3 - Value
Item2 Name
Property - Value
How I have my template set up:
<TableStart:ItemName>
<>
(Actual Table here) | <TableStart:prop><> | <><TableEnd:prop> |
<TableEnd:ItemName>
What I get:
Item1 Name
EVERY PROPERTY AND VALUE FOR ALL ITEMS
Item2 Name
Empty table just showing merge fields
Item2 Name
Empty … and so on.
And now for the code (VB):
(constructors and generator code exlcuded, it works)
dim itemproperties as objects.itemproperties() = _org.items.itemproperties
dim itemNameTable as new datatable(“itemName”)
itemNameTable.Columns.Add(“Item Name”)
Dim itemPropertyTable as new datatable(“Prop”)
itemPropertyTable.Column.Add(“Property”)
itemPropertyTable.Column.add(“Value”)
Dim itemName as objects.itemproperties() = (from d in itemproperties order by d.itemname, d.itemname select d).toarray
dim itemprop as objects.itemproperties() = (from d in itemproperties order by d.itemprop, d.itemprop select d).toarray
for each itn in itemName
itemNameTable.Rows.Add(itn.itemname)
next
fore each itp in itemprop
itemPropertyTable.Rows.Add(ipt.itemprop, itp.itemvalue)
next
REST OF CODE
Now obviously this is a much simpler markup of what I’m doing, but the problem lies right there… somewhere…
Hi there,
Thanks for your inquiry.
The symptom your application is showing is normally caused by DataRelations between tables not being set up properly or at all.
Please make sure you have set data relations for your DataSet as shown in the article here: http://docs.aspose.com/display/wordsnet/How+to++Set+up+Relations+for+use+in+Nested+Mail+Merge+with+Regions
If you have any further problems, could you please attach your code and template here for testing?
Thanks,