0

Scenario is somewhat like this: I have n number of subsites and each subsite contains two lists(exactly same in all subsites) having parent child relationships using a lookup column, need to populate data from all subsites by joining on the basis of lookup columns.

I am able to get the data using spsitedataquery from one list throughout the site collection but join is not possible in spsitedataquery.

here are the columns ParentList : CourseID, Course Name

Child List : CourseID(lkup), User

  • One possible way i can see is to write a spquery with join to fetch data from both lists. Iterate through all subsite execute the same query an append results to a datatable, and finally bind the datatable to a any datasource(list view in my case), but i guess performance will be an issue with this approach – user4205 Aug 26 '13 at 13:44
0

SPSiteDataQuery is the right way to go about this, but it will not aggregate or combine the data for you like a relational database will. You can use many methods to do so, but you might consider using a DataTable as @user4205 mentioned in a comment. You can find an example on Microsoft's site.

0

The way using which I achieved this is

1) Added two SPSiteDataQuery to fetch information from two lists across the site collection, one from parent and other from Child.

2) Then used linq two join two datatables, returned by the above query.

Not sure if this is the best approach but may be one of the best approaches :P .

Any suggestions will be welcome :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.