Export To Word - Using Entity Relationships in Column Mappings

Dec 14, 2012 at 10:09 AM
Edited Dec 14, 2012 at 10:12 AM


I am trying to generate a Word document in Lightswitch 2012, and am having problems with the column mappings.

The Entity object on my screen is "Invoice", and any field that is part of the entity maps without any problem - eg InvoiceDate

But any field which is derived through a relationship does not get exported. I have tried using both the object notation




and the name of the control on the actual screen


But neither of the above works. An example of the full mapping code is below.

InvoiceFields.Add(new OfficeIntegration.ColumnMapping("CustomerName", "Invoice.SalesOrder.Project.Customer.Name"));
InvoiceFields.Add(new OfficeIntegration.ColumnMapping("Address1", "Invoice_SalesOrder_Project_Customer_Address1"));
InvoiceFields.Add(new OfficeIntegration.ColumnMapping("InvoiceDate", "InvoiceDate"));

Any help would be greatly appreciated. Thanks

Dec 14, 2012 at 11:08 AM

UPDATE: A reply found on Lightswitch forum implies that traversing entity relationships is not possible. The simplest approach is to create a single view with all the data to be exported in the view. Full details can be found here.