web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Help Needed: How to Ad...
Power Apps
Unanswered

Help Needed: How to Add Rows from Existing Collection AND Static Fields Together Into A New Collection

(0) ShareShare
ReportReport
Posted on by 42

Hello,

 

Background:

I am working on building a timetracking app for our project teams to use.  In it, on the CREATE NEW TIMESHEET page, users can select a checkbox and choose to copy activity line items from a previous week's timesheet (timesheet data stored in Dataverse).  I was able to pull the previous week's timesheet data into a collection for use in the timesheet, however it then needs to be added into a new collection which has additional columns, filled with values from the form.

 

Question:

How can I add into a collection (collect, patch, etc.) values which in part take from this existing collection (previous timesheet activities rows {Activity, ProjectNum, HoursMon, HoursTue, HoursWed, etc....}), and add additional static values filled out in the form at the same time (ex: TimesheetStartDate, TimesheetResourceID, TimesheetStartDate), which represent identification of the newly created timesheet that these line items must match to.

 

Additionally, the columns coming from the dataverse table and the collection are different, so I need to relate the dataverse column names to match to the collection names.

 

Here is the Collect() function I use in the next segment of the app to add an individual row into the collection.  I just can't figure out how to modify it so that all the values from the previous weeks data can be added in at once.

 

If(IsBlank(ddTSCopyFromDate.Selected)=false,Collect(colNewTSLineItems,{
        PrjNumShort: {Needs to be fed from each line of the other collection},
        prjNamDesc: {Needs to be fed from each line of the other collection},
        Activity: {Needs to be fed from each line of the other collection},
        prjWBScode: {Needs to be fed from each line of the other collection},
        hrsMon:{Needs to be fed from each line of the other collection},
        hrsTue: {Needs to be fed from each line of the other collection},
        hrsWed: {Needs to be fed from each line of the other collection},
        hrsThu: {Needs to be fed from each line of the other collection},
        hrsFri: {Needs to be fed from each line of the other collection},
        hrsSat: {Needs to be fed from each line of the other collection},
        hrsSun: {Needs to be fed from each line of the other collection},
        hrsTotal: {Needs to be fed from each line of the other collection},
        Ref_TimesheetID: LookUp(colNewTSRecord,lblNewTSEmployeeID.Text=Resource_ID,Timesheet_ID),
        Ref_TimesheetStartDateID: LookUp(colNewTSRecord,lblNewTSEmployeeID.Text=Resource_ID,Timesheet_WeekStartDate_ID),
        Ref_TimesheetResourceID: LookUp(colNewTSRecord,lblNewTSEmployeeID.Text=Resource_ID,Resource_ID)
    }),"")
Categories:
I have the same question (0)
  • Verified answer
    mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at

    hey @PowerApp_Chaos 

     

    can you tr this approach:

    If(!IsBlank(ddTSCopyFromDate.Selected),
     ForAll(
     colPrevTSData,
     Collect(
     colNewTSLineItems,
     {
     PrjNumShort: ProjectNum, // Assume 'ProjectNum' maps to 'PrjNumShort'
     prjNamDesc: ProjectDesc, // Similarly map these from `colPrevTSData`
     Activity: Activity,
     prjWBScode: WBSCode, // Make sure the field names match those in `colPrevTSData`
     hrsMon: HoursMon,
     hrsTue: HoursTue,
     hrsWed: HoursWed,
     hrsThu: HoursThu,
     hrsFri: HoursFri,
     hrsSat: HoursSat,
     hrsSun: HoursSun,
     hrsTotal: HoursTotal,
     Ref_TimesheetID: LookUp(colNewTSRecord, lblNewTSEmployeeID.Text = Resource_ID, Timesheet_ID),
     Ref_TimesheetStartDateID: LookUp(colNewTSRecord, lblNewTSEmployeeID.Text = Resource_ID, Timesheet_WeekStartDate_ID),
     Ref_TimesheetResourceID: LookUp(colNewTSRecord, lblNewTSEmployeeID.Text = Resource_ID, Resource_ID)
     }
     )
     )
    )
    

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

  • PowerApp_Chaos Profile Picture
    42 on at

    Thank you, this worked to resolve my situation!!

  • mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at

    Great, glad i was able to help

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard