0

I want to get data from multiple table in to one list. And I don't know how to do it.

Please help me with a detail example.

3

Content Query WebPart is a good solution, but since you are using SharePoint 2013, you can use SharePoint 2013 new feature Content Search WebPart, this is also very good. Following are the steps to achieve the goal:

Requirement:
I have couple of lists in the SharePoint, I need top show them in webpart in list format.

Solution:
I have four lists in the site, they are List1, List2, List3 and List4. The data in the lists are as follows:
List1:

enter image description here
List2: enter image description here
List3: enter image description here
List4 enter image description here

Now I need to show them in list format all data. Following are the steps:

  • Go to Central Admin > Manage service applications under Application Management
  • Click on Search Service Application
    enter image description here
  • Click on the Content Source under Crawling in the lift side.
    enter image description here
  • Start Full crawl as follows:
    enter image description here
  • Wait for it's completion
  • Once it's completed go back to your site and edit the home page
  • Add Content Search webpart under Content Roll up.
    enter image description here
  • Edit the Web Part, put 50 in the Number of items in the field and click on the Change Query button.
  • Click on the Switch to Advance Mode link.
    enter image description here
  • Put following query in the Query Text field:

contentclass:STS_ListItem AND (path:http://SiteURL/sites/hub/Lists/List1 OR path:http://SiteURL/sites/hub/Lists/List2 OR path:http://SiteURL/sites/hub/Lists/List3 OR path:http://SiteURL/sites/hub/Lists/List4)
Exlanation of the Query: First Part--> contentclass:STS_ListItem --> depicts the result's content type must be ListItem. Second Part--> path --> depicts where from the data should be retrieved. Since I am fetching the data from 4 lists, I have put 4 lists name in OR format.

enter image description here - Click OK
- Change the Display template of the Item to Two Lines
enter image description here
- Click OK button
- Save the Page. Following will be the results: enter image description here

You can see all the data is coming from the 4 different list List1, List2, List3 and List4. The above process will create a simple view. If you want to change the view, you can do it very easily by editing the Display template HTML of the Content Search Webpart, which is saved in the Site Settings > Master pages and page layouts > Display Templates > Content WebPart. If you want to introduce any custom column in the Search Result, you can do it by adding that column as Managed Property and adding it in the Display Template.

0

There two detail article which will show with screen how to do it:

  • I want in SharePoint 2013 – Mehdi Jalal Aug 17 '14 at 10:45
0

You can use SPSiteDataQuery Class. This class allows you to fetch data from multiple lists by querying against them.

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.