cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

DataTable with 2 Sharepointlists

Hello Forum,

i have a Problem and i guess it's a little tricky.

 

I have a DataTable with connect to a SharePointList und gets Data. This works fine.

 

SortByColumns(
Filter(
SharePointList;
If(
Status.Value = "Belehrung";
Mitgliedsnummer = verstossMeldenMitglNr And Status.Value = "Belehrung";
true
);
If(
Status.Value = "Verstoß";
Mitgliedsnummer = verstossMeldenMitglNr And Status.Value = "Verstoß" And Author.Email = User().Email;
true
)
);
"Kontrolliert_x0020_am";
Descending
)

 

Is it Possible to get data from 2 SharePointLists at the same time

 

e.g. Show Data in the datatable from List 1 and List 2 mixed at same time?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: DataTable with 2 Sharepointlists

@Tamer66 

The solution is pretty straightforward to implement if you use collections.  Are you comfortable using collections?

 

Here's an example. I have two lists: MyList1 [1,2,3] and MyList2 [4,5,6].  I can set them up with the following code.

 

ClearCollect(MyList1,{value:1},{value:2},{value:3});
ClearCollect(MyList2,{value:4},{value:5},{value:6});

 

I want MyList3 to holds the values from both tables [1,2,3,4,5,6] so I can use this code to make the join

 

ClearCollect(MyList3,MyList1,MyList2);

 

There are two things you must consider before using my method:

1.  Any code using the ClearCollect function must be placed in a behaviour based property such as OnVisible, OnSelect, OnStart, etc.  You cannot directly enter it into the Items property of a data table or gallery.

2.  My assumption is the column names in your 2 Sharepoint Lists match each other

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

View solution in original post

1 REPLY 1
Highlighted
Super User
Super User

Re: DataTable with 2 Sharepointlists

@Tamer66 

The solution is pretty straightforward to implement if you use collections.  Are you comfortable using collections?

 

Here's an example. I have two lists: MyList1 [1,2,3] and MyList2 [4,5,6].  I can set them up with the following code.

 

ClearCollect(MyList1,{value:1},{value:2},{value:3});
ClearCollect(MyList2,{value:4},{value:5},{value:6});

 

I want MyList3 to holds the values from both tables [1,2,3,4,5,6] so I can use this code to make the join

 

ClearCollect(MyList3,MyList1,MyList2);

 

There are two things you must consider before using my method:

1.  Any code using the ClearCollect function must be placed in a behaviour based property such as OnVisible, OnSelect, OnStart, etc.  You cannot directly enter it into the Items property of a data table or gallery.

2.  My assumption is the column names in your 2 Sharepoint Lists match each other

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

View solution in original post

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (2,323)