Wow, there are a LOT of possible solutions for this. I haven't found the right one yet as most are either at one end or the other of what I need to do.
I need to create a collection of data that pulls all the detail information for a specific date from one collection and then add the master data to each record.
DataSource1 - MasterData:
ProjectName
ProjectType
CourseType
ID (Key field)
DataSource2 - Detail:
Title (Text field, This is a person)
Role
WeekEnding
Hours
MasterID (Key field)
I need to create a filtered collection of data from DataSource2 for a specific date and for each record that is found, add the corresponding data (ProjectName, ProjectType & CourseType) from DataSource1 using the ID-MasterID match.
The result:
Collection:
ProjectName
ProjectType
CourseType
Title
Role
WeekEnding
Hours
I found solutions for adding all columns and adding a single column but not for adding specific multiple columns.
Any help will be greatly appreciated.
Solved! Go to Solution.
didnt test it, should be like :
Clear(colDetailWithMasterData);
ForAll( Filter(Detail, yourColumn = yourdate) As ThisDetail,
With({tempMasterData: LookUp(MasterData, ID = ThisDetail.MasterID )},
Collect(colDetailWithMasterData,
{
'ProjectName': tempMasterData.ProjectName,
.... etc for data taken from masterdata
'Title': ThisDetail.Title,
.... etc for data taken from Detail
}
)
)
)
I found a way to do what I was attempting. I really didn't need the collection at all. The only value it was providing was displaying the merged information from the two data sources. It was only used for seeing what had been added today and providing a vehicle to edit the information.
Here is the Video I found: https://www.youtube.com/watch?v=U-WN4OFZ1kw
And this ended up being my formula. It works exactly as I wanted it to:
Filter(
AddColumns(
DemoWeeklyProjectHoursReporting,
"ProjectDetails",
LookUp(DemoProjectList,
ID = MasterID)
),
SortDate = Text(DatePickerWeekEnding.SelectedDate)
)
The Gallery fields are like this:
ThisItem.ProjectDetails.CourseType.Value
ThisItem.DevHours
How about?:
ClearCollect(colCollection,Blank());
ForAll(DataSource2 As ItemTable,
Collect(colCollection,
{
ProjectName: LookUp(DataSource1, ID = ItemTable.MasterID,ProjectName),
ProjectType: LookUp(DataSource1, ID = ItemTable.MasterID,ProjectType),
CourseType: LookUp(DataSource1, ID = ItemTable.MasterID,CourseType),
Title: ItemTable.Title,
Role: ItemTable.Role,
WeekEnding: ItemTable.WeekEnding,
Hours: ItemTable.Hours
}
)
);
didnt test it, should be like :
Clear(colDetailWithMasterData);
ForAll( Filter(Detail, yourColumn = yourdate) As ThisDetail,
With({tempMasterData: LookUp(MasterData, ID = ThisDetail.MasterID )},
Collect(colDetailWithMasterData,
{
'ProjectName': tempMasterData.ProjectName,
.... etc for data taken from masterdata
'Title': ThisDetail.Title,
.... etc for data taken from Detail
}
)
)
)
This is great. After thinking about it, I am wondering if this formula could be adapted to provide the same capability (displaying the related information) without creating a collection to do it?
With this kind of ForAll structure, you could Patch back to your DataSource2 and add columns to it.
Or, a ForAll can directly return a table, but it doesn't work to add columns that way.
Maybe an AddColumns with Lookup inside is what you are after?
I'm curious, why avoid making the collection?
It's not necessary to avoid the collection, it might make it a little easier on the updating side of things. It was more curiosity than anything else as I work through the best way to keep the overhead down.
I found a way to do what I was attempting. I really didn't need the collection at all. The only value it was providing was displaying the merged information from the two data sources. It was only used for seeing what had been added today and providing a vehicle to edit the information.
Here is the Video I found: https://www.youtube.com/watch?v=U-WN4OFZ1kw
And this ended up being my formula. It works exactly as I wanted it to:
Filter(
AddColumns(
DemoWeeklyProjectHoursReporting,
"ProjectDetails",
LookUp(DemoProjectList,
ID = MasterID)
),
SortDate = Text(DatePickerWeekEnding.SelectedDate)
)
The Gallery fields are like this:
ThisItem.ProjectDetails.CourseType.Value
ThisItem.DevHours
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
User | Count |
---|---|
170 | |
94 | |
64 | |
64 | |
60 |
User | Count |
---|---|
243 | |
163 | |
95 | |
85 | |
82 |