cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
imaliasad
Level: Powered On

Update data with Patch and Lookup

Hi everyone,

 

This is very basic, but I'd like to ask how can I update the form data by using Patch and Lookup. Here's my code for inserting the data with a Patch function.  I'm an absolute beginner please bear with me. Thank you.

 

Patch(
    Table_SiteTimesheet,
    Defaults(Table_SiteTimesheet),
    {
        Work_Date: Value(Date_WorkDate_1.SelectedDate),
        Name_Project: DD_NameProject_1.Selected.Name_Project,
        Code_Project: DD_NameProject_1.Selected.Code_Project,
        Note: Text_Note_1.Text,
        Start: DD_StartTime_1.Selected.Value,
        End: DD_EndTime_1.Selected.Value,
        User_Name: User().Email,        
        ModifiedOn_Date: Today()
    }
);
1 ACCEPTED SOLUTION

Accepted Solutions
myke_deabreu
Level 8

Re: Update data with Patch and Lookup

I think I understand what you asking.

 

First assign the ID you want to update to a varible (e.g. Set(varname, the id you updating) 

 

Then you could do something like this:

 

Patch(
Table_SiteTimesheet,
First(Filter(Table_SiteTimesheet,ID_Timesheet=varname)),
{
Work_Date: Value(Date_WorkDate_1.SelectedDate),
Name_Project: DD_NameProject_1.Selected.Name_Project,
Code_Project: DD_NameProject_1.Selected.Code_Project,
Note: Text_Note_1.Text,
Start: DD_StartTime_1.Selected.Value,
End: DD_EndTime_1.Selected.Value,
User_Name: User().Email,
ModifiedOn_Date: Today()
});

 

Let me know if you dont understand or it doesnt work.

4 REPLIES 4
myke_deabreu
Level 8

Re: Update data with Patch and Lookup

Hi imaliasad,

 

What are you trying to lookup? 

imaliasad
Level: Powered On

Re: Update data with Patch and Lookup

Hi @myke_deabreu thank you for replying again. 

 

I have a column name ID_Timesheet, which I'd like to use with Lookup to update the record of that row. can I do that with Patch and Lookup, if yes would appreciate if you explain it to me

myke_deabreu
Level 8

Re: Update data with Patch and Lookup

I think I understand what you asking.

 

First assign the ID you want to update to a varible (e.g. Set(varname, the id you updating) 

 

Then you could do something like this:

 

Patch(
Table_SiteTimesheet,
First(Filter(Table_SiteTimesheet,ID_Timesheet=varname)),
{
Work_Date: Value(Date_WorkDate_1.SelectedDate),
Name_Project: DD_NameProject_1.Selected.Name_Project,
Code_Project: DD_NameProject_1.Selected.Code_Project,
Note: Text_Note_1.Text,
Start: DD_StartTime_1.Selected.Value,
End: DD_EndTime_1.Selected.Value,
User_Name: User().Email,
ModifiedOn_Date: Today()
});

 

Let me know if you dont understand or it doesnt work.

imaliasad
Level: Powered On

Re: Update data with Patch and Lookup

Thank you so much, this is exactly what I was looking for. Smiley Happy