cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SandraAkujobi
Post Partisan
Post Partisan

Struggling with Patch Function

I've been trying to use patch function to patch several screens. I've gotten to some extent but still finding it difficult.

It's quite different in my case as I i'm creating a timesheet and each edit screen represents days of the week which I'm trying to use patch to collect all entries as one form and instead of putting the patch formula on the submit icon, I have it on the clock in and out buttons on each screens. 

The formula I'm using for the clock in button keeps showing an error:

 

Set(VARmoncurrentdateandtime, Now());
Set(
    SubmittedRecord,      // save the 'Check In' record into a variable
    Patch(
         WeeklyTimeSheet2,
         Defaults(WeeklyTimeSheet2),
         {
          Title: ID.Text,
          Employee_name: empname.Selected,
          Contract_no: contr.Selected, ApprovalStatus:Approve.Selected,
          ClockIn: MonDay.SelectedDate + Time(Value(MonHour.Selected.Value), Value(MonMin.Selected.Value), 0),
          ClockOut: MonEndDay.SelectedDate + Time(Value(MonEndHour.Selected.Value), Value(MonEndMin.Selected.Value), 0)
         }
     )
)

 

when putting the formula for the clock out is that where I would now add in the lookup feature. For the other days how would I cry on with the formula so that entries would be stored as one, because from previous tries they keep storing as individual entities also when I submit one entry I get an approval request for that one entry instead of the whole weekly entry.

 

4 REPLIES 4
v-bofeng-msft
Community Support
Community Support

Hi @SandraAkujobi :

Sorry, I don’t understand your needs.

Could you tell me:

1\What is your problem?

  • Solve the error?(the clock in button keeps showing an error)
  • Store the entries  as one?(that entries would be stored as one)

2\What is the error?(the clock in button keeps showing an error)

3\What is the meaning of "entries would be stored as one"?

4\What is WeeklyTimeSheet2's data structure?

5\What are you going to achieve with this app?

Best Regards,

Bof

@v-bofeng-msft 

The whole purpose of the app is to collect employees daily timesheet entries and then by the end of the week the entries will be sent out as one weekly form to their respective manager to view and approve. 

Right now the single form is packed with information that need to be put in by the employees for each separate days like contract number, activity,clock in and out etc so I separated each day by screens to make it that each day would have their own form to make it look more presentable. The issue with that is that whenever they put in their entries for each day, they are each stored as one individual entry instead of just being in one form for the week. Which is why I was told to use patch. But it's been very hard to do. there hasn't been a change with the formula at all.  I'm not sure if it's the patch formula I'm using or not. All these information are stored in the sharepoint list for the weeklytimesheet.

 

This is actually the correct formula used for the actual app. there is no error shown here but the issue is that the entries are being stored twice, so when you clock in the time is stored incorrect, and when you clock out the entries stores again as another entry instead of being in the same form but then it's stored as the right time. As you can see in the two images below.

Set(VARmoncurrentdateandtime, Now());
Set(
    SubmittedRecord,      // save the 'Check In' record into a variable
    Patch(
         WeeklyTimeSheet,
         Defaults(WeeklyTimeSheet),
         {
          Title: ID.Text,
          Emp_Name: EmpName.Selected,
          Mon_Activity: MonAct.Selected,
          Mon_Contract: MonContract.Selected,
          Mon_Start: MonDay.SelectedDate + Time(Value(MonHour.Selected.Value), Value(MonMin.Selected.Value), 0),
          Mon_End: MonendDay.SelectedDate + Time(Value(MonendHour.Selected.Value), Value(MonendMin.Selected.Value), 0)
         }
     )
)

 Screenshot (221).pngScreenshot (222).png

Hi @SandraAkujobi :

Let me sort out the logic, if there are any errors, please help me point out:

  • There are five screens and each screen have a new from.
  • Employees fill out a form every day and submit the contents of the five from at the same time on the last day.
  • The contents of these 5 from will be saved as one record into the SP list.

If my understanding is correct:

  • How are you going to summarize these records into one record? What is its data structure?
  • What is the data structure of the data source SubmittedRecord?

Best Regards,

Bof

@v-bofeng-msft 

Yes so there are 6 screens and each screen represents each day except for the 6th screen that has Saturday and Sunday on it together. Employees will fill out the form for the day they are on. Exactly the contents of these 6 forms will be saved as one record into the SP list. 

Initially the form had all the days on it which looked untidy, which is why I created separate screens for them. I was thinking of using patch to summarise each records into one form. 

 

Title is text.

Activity for each day is a choice column.

Employee is Person/Group column.

Contract is a Lookup column.

Start and End times for each day is date/time field.

 

Screenshot (229).pngScreenshot (230).png

 

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,991)