cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Patch calculated value to SP list using LookUp function

Hello,

Background info:
I'm building an PowerApp to track time for multiple employees. The daily inputs go to my first SP list.

To check if the employee has overtime (and can take a day off) the working hours are compared to their daily hours (depending if they work full time or part time) based on the current day. The daily target is saved in a second SP list ("MA_Wochenarbeitszeit").

 

I'm currently using an edit screen and only the difference of the hours is visible (but is on Displaymode.View). The hours difference is automatically calculated in the App and I want to patch the calculated value to the one row in my second SP list that belongs to the logged in user (and update the content of the column every time they track time).

 

I use the following code (OnSelect of the IconBackarrow):

 
Patch(MA_Wochenarbeitszeit; LookUp(MA_Wochenarbeitszeit; Mail=UserEmail); {Differenz:Stundendifferenz})

The list is called "MA_Wochenarbeitszeit", the column in the list with the mail adress is called "Mail", the difference of hours (actual amount minus target) should be in the column "Differenz", the cell in the PowerApps Edit screen is called "Stundendifferenz"

 

Why isn't this working?

 

The "error code" is:

the requested operation is invalid. Object must implement IConvertible

 

Thanking you in anticipation

Xenia

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

It works with:

Patch(MA_Wochenarbeitszeit; LookUp(MA_Wochenarbeitszeit;UserEmail=Mail); {Differenz:Int(Stundendifferenz)})

View solution in original post

8 REPLIES 8
Nogueira1306
Super User
Super User

Stundendifferenz, is it an int, string, float?
And Differenz?

If they are both int or float, try that:

 

Patch(MA_Wochenarbeitszeit; LookUp(MA_Wochenarbeitszeit; Mail=UserEmail); {Differenz:Value(Stundendifferenz)})

 

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,

Gonçalo Nogueira

Check my LinkedIn!

Buy me a coffee!

Check my User Group (pt-PT)!

Last Post on Community

My website!

Anonymous
Not applicable

@Nogueira1306thanks for your answer

 

Stundendifferenz is float (i.e. 37,07 or ##,##)

Differenz is also float (same)

 

I already tried this code before, sadly, it doesnt work

Patch(MA_Wochenarbeitszeit; LookUp(MA_Wochenarbeitszeit; Mail=UserEmail); {Differenz:Value(Stundendifferenz)})

The error code says

text or number expected

"Value: Stundendifferenz" is underlined in red

Show em how you create that var, the Stundendifferenz var. Or if it is a text input or not

 

 

Anonymous
Not applicable

It is a text input with the format "number", its default value is

((Stundenuebertrag+'Ist-Stunden')-'Soll-Stunden')

 

(in english: ('overtime of the last month' + 'actual amount') - 'target')

Patch(MA_Wochenarbeitszeit; LookUp(MA_Wochenarbeitszeit; Mail=UserEmail); {Differenz:Value(Stundendifferenz.Value)})

 

Anonymous
Not applicable

Now the whole part

Value(Stundendifferenz.Value  

 is underlined in red

Anonymous
Not applicable

It works with:

Patch(MA_Wochenarbeitszeit; LookUp(MA_Wochenarbeitszeit;UserEmail=Mail); {Differenz:Int(Stundendifferenz)})
Anonymous
Not applicable

@Nogueira1306  thanks for helping 🙂

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,561)