cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
memphis11
Helper I
Helper I

Merge 2 Dataverse tables into one collection

Hello, everyone,

 

I have a question about merging two tables from Dataverse.


I create two collections based on certain values:

 

ClearCollect(mySCH;
ShowColumns(tbl_SCHSCHImport;
"kol__guid";
"kol__Surname";
"kol__class";
"kol__password"

));;

 

ClearCollect(myTEACHER;
ShowColumns(tbl_SCHTeacher;
"kol__subject";
"kol__teacher";
"kol__class"
));;

 

now i would like to merge both collections into one, and this based on the column kol__class

 

My attempt:

ClearCollect(myTable;
Ungroup(
DropColumns(
AddColumns(
myTEACHER;
"myGroupedColumn";
Filter(
mySCH;
kol__class=myTEACHER[@kol__class]
)
);
"kol__class"
);
"myGroupedColumn"
)
);;

 

Unfortunately I have the problem that my
values are not displayed in the new collection (myTable) with this formula

 

greetings

11 REPLIES 11
memphis11
Helper I
Helper I

Sorry, i have one more question.

 

There are about 200 users in my mySCH Collection, but only one user is displayed in myTable

memphis11_0-1663595927205.png

 

But the assignment of one user is completely correct, so thanks again

 

Of course, this is also the case when I load the collection in a gallery

@memphis11 

 

 

Are you trying it like this?

//pseudocode - not tested

//Create two collections
ClearCollect(mySCH;
ShowColumns(tbl_SCHSchuelerImport;
"kol__guid";
"kol__nachname";
"kol__vorname";
"kol__klasse";
"kol__anmeldename";
"kol__passwort"

));;

 

ClearCollect(myTEACHER;
ShowColumns(tbl_SCHZuordnungLehrer;
"kol__fach";
"kol__lehrer";
"kol__klasse"
));;

 
Clear(myTable);;

ForAll
(
    mySCH As TCH
    ;ForAll
    (
        myTEACHER As SCH  
        ;If(SCH.kol__klasse = TCH.kol__klasse;Collect(myTable;{kol__guid:SCH.kol__guid;kol__nachname:SCH.kol__nachname;kol__vorname:SCH.kol__vorname;kol__klasse:SCH.kol__klasse;kol__anmeldename:SCH.kol__anmeldename;kol__passwort:SCH.kol__passwort;kol__fach:TCH.kol__fach;kol__lehrer:TCH.kol__lehrer}))
    
    
    )
);

 

 

If the above is still giving the same value for kol__vorname, let me know.

Also, are you checking all the items of the Collection in a Gallery and scrolling through all of them? Maybe you have a lot of records with the student "Desire...." and the other records are much farther down.

 

Check if it helps @memphis11 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,668)