Data from Join tables not being displayed properly

2 posts, 0 answers
  1. Clement
    Clement avatar
    2 posts
    Member since:
    Jul 2010

    Posted 12 Sep 2012 Link to this post

    I'm displaying a List of Schemes on a grid and two of the columns are from the following join tables.

    1. SchemeTown -- stores towns associated with the scheme (scheme_id, town_id)
    2. SchemeDivision - stores divisions associated with the scheme (scheme_id, division_id)

    on the grid, among other information, I'm successfully displaying name of the town and division for each scheme.

    Problem comes when I export this data to an excel sheet or of I want to display this data in a report, the town and division name are not exported, I've attached an excel sheet to show how they are being outputted.

    The export to excel and report display get their data from the same data source as the grid mentioned above. The following code block shows how this data is retrieved from the database.

    public List<SchemeSystem> GetAllSchemeSystems()
                return (from schemeSystem in DataHandler.Extent<SchemeSystem>() where schemeSystem.Planned == false & schemeSystem.Id != Guid.Empty select schemeSystem).ToList<SchemeSystem>();

    and the following is the SchemeSystem entity
    public partial class SchemeSystem
           //The 'no-args' constructor required by OpenAccess.
           public SchemeSystem()
           public Guid Id
               get { return id; }
               private set { id = value; }
           public string Name
               get { return name; }
               set { = value; }
           public Wsp Wsp
               get { return wsp; }
               set { this.wsp = value; }
           public bool Planned
               get { return planned; }
               set { this.planned = value; }
           public IList<SchemeSystemData> SchemeSystemDatas
               get { return schemeSystemData; }
           public IList<Town> schemeTown
               get { return schemeTowns; }
           public IList<Division> schemeDivision
               get { return schemeDivisions; }

    What do I need to do to display the Division and Town names in my report and Excel?

  2. Viktor Zhivkov
    Viktor Zhivkov avatar
    290 posts

    Posted 17 Sep 2012 Link to this post


    My suggestion is to define a Fetch Strategy,Plan or Group that load schemeTown and schemeDivision collections explicitly before exporting data to Excel. 
    This can find more information how to use Fetch Plans and our Extent based API in this set of articles or check how to use the new context based API in this article.

    If you need further assistance please post the code that does the actual export to the Excel file.

    All the best,
    Viktor Zhivkov
    the Telerik team
    Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
  3. DevCraft banner
Back to Top