none
Fetch data from another list based on item data RRS feed

  • Question

  • Hello

    I would like to fetch data from a column in a different SharePoint list. Can tell me how?

    I want to populate a field "City", in a list, based on the city of the user. The city of the user is saved in a different list and I was thinking of use [Me] to identify the user and fetch the city.

    Ideas/Suggestions?

    Thank you

    Leonel


    lg

    Friday, September 20, 2019 12:51 PM

Answers

  • Here is the solution for you. Completely OOTB. Follow the steps below. 

    1. You have 2 lists. In below example I have 2 lists - Clients & Projects.
    Columns in Clients list -> Title (Contains User's email address - must be single line), City

    Columns in Projects list -> Title, Lookup to Title in Projects (which is User email id and along with it City is selected as extended column). Add your data in it and you will get your mapping.

    

    2. Create a WEB PART PAGE. Add list views of both these lists on the page. Add 1 more web part -> Current User Filter (Under Filters section). This web part gives you properties of the user who visits the page. Configure web part properties as shown below.

    User Principal Name will have the EMAIL ID of the user (if entered in the AD).

    3. Now, connect this web part to Clients list (list containing user details and city). User Web Part -> Title (column containing email id in the list)

    4. You will now see a single row in the clients list view on the page which will be current user's details. Now you have current user's city column and in projects list view on the page you have the city column extended from lookup. So, you can connect these 2 fields by using web part connection from Clients -> send data to Projects list -> select city columns in both the lists.

    5. The projects list will be filtered on the city of the current user.

    Here is the result. You can hide the clients list view web part. And only projects list will be viewed on the page.

    If this is the solution then PLEASE UPVOTE AND MARK AS ANSWER. It will help others who land on this question.


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    • Proposed as answer by HarshalGite Friday, September 20, 2019 5:06 PM
    • Marked as answer by Leonel GUZMAN Sunday, September 22, 2019 2:22 PM
    Friday, September 20, 2019 4:29 PM

All replies

  • If the user is a lookup field to your list, then you can extend it to get the city of the user along with user.

    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Friday, September 20, 2019 1:46 PM
  • Just Create a Lookup column and pull the column value from another list.

    check below article for reference:

    https://www.c-sharpcorner.com/article/pull-a-column-value-from-another-list-in-your-site-in-sharep/

    Thanks & Regards,


    sharath aluri

    Friday, September 20, 2019 1:51 PM
  • Thank you very much HarshalGite. I think you're getting me on the right track :-)

    I have a follow-up question.

    The ultimate objective is to filter the view based on the city of the user; so what I need to do is:

    1) Detect who the user is ([Me]).

    2) Then based on the user, fetch the city as you suggest.

    Would you have a suggestion to do this as the view opens and applies the filter?

    Thank you again

    Best


    lg

    Friday, September 20, 2019 2:55 PM
  • Here is the solution for you. Completely OOTB. Follow the steps below. 

    1. You have 2 lists. In below example I have 2 lists - Clients & Projects.
    Columns in Clients list -> Title (Contains User's email address - must be single line), City

    Columns in Projects list -> Title, Lookup to Title in Projects (which is User email id and along with it City is selected as extended column). Add your data in it and you will get your mapping.

    

    2. Create a WEB PART PAGE. Add list views of both these lists on the page. Add 1 more web part -> Current User Filter (Under Filters section). This web part gives you properties of the user who visits the page. Configure web part properties as shown below.

    User Principal Name will have the EMAIL ID of the user (if entered in the AD).

    3. Now, connect this web part to Clients list (list containing user details and city). User Web Part -> Title (column containing email id in the list)

    4. You will now see a single row in the clients list view on the page which will be current user's details. Now you have current user's city column and in projects list view on the page you have the city column extended from lookup. So, you can connect these 2 fields by using web part connection from Clients -> send data to Projects list -> select city columns in both the lists.

    5. The projects list will be filtered on the city of the current user.

    Here is the result. You can hide the clients list view web part. And only projects list will be viewed on the page.

    If this is the solution then PLEASE UPVOTE AND MARK AS ANSWER. It will help others who land on this question.


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    • Proposed as answer by HarshalGite Friday, September 20, 2019 5:06 PM
    • Marked as answer by Leonel GUZMAN Sunday, September 22, 2019 2:22 PM
    Friday, September 20, 2019 4:29 PM
  • Wow Harsh! Thx a lot

    I'll try this weekend (kinda late here now) and will update!

    I appreciate it a lot (you've used your time to answer!)

    lg


    lg

    Friday, September 20, 2019 4:35 PM
  • Thank you very much HarshalGite,

    With your help I managed to do what I wanted.

    I also found another way. Without use the filter WebApp I can also connect the tables. The list with members opens on a filter based on [Me], and then the second list is filtered based on that member (i.e. [Me]).

    Than you again

    lg


    lg

    Sunday, September 22, 2019 2:24 PM
  • Hi Leonel GUZMAN,

    Thank you for your sharing.

    Best regards,

    Sara Fan

    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Monday, September 23, 2019 7:08 AM
    Moderator