locked
Display related properties from many-to-many relationship in VS Lightswitch 2012 RRS feed

  • Question

  • Hi everyone.  I am having an issue trying to display a related property from a many-to-many relationship.  I have read this article http://social.msdn.microsoft.com/Fo...e6b0e22ad, but didn't get very far figuring out how to get the properties to display.

    I have these 3 tables:

    MaintenanceAgreements MaintenaceAgreementsSiteAssets SiteAssets
    ID MaintenanceAgreementID ID
    ContractNumber SiteAssetID SerialNumber
    ExpirationDate InstallDate
    Type

    What I would like to do is display the ExpirationDate and Type from the maintenance agreement table having the max(ExpirationDate) on the SiteAssets details screen.

    I was able to get the max(ExpirationDate) to display by adding a calculated field to the SiteAssets table and adding the following code to the compute method for the calculated field:


    result = Me.MaintenanceAgreementSiteAssets.Max(Function(e) e.MaintenanceAgreement.ExpirationDate)

    That works great for displaying the most current ExpirationDate for the SiteAsset, but I also need to be able to display the Type associated with that same MaintenanceAgreement.  Any pointers on how to do this?

    Thanks!

    Wednesday, June 12, 2013 2:15 PM