Hi Guys,
i'm trying to update the 2nd last record in a Table with a date value. There is a service description with valid dates.
When the user creates a new service description, the most recent record should be updated with a valid until date and a new record needs to be created.
I tried this with two Patch Statements. The new record will be created but the most recent record will not be updated.
Could you help?
Whats wrong here?
Patch(
UDID;
Defaults(UDID);
{
until: DatePicker1_1.SelectedDate;
ID: First(LastN(Gallery1.AllItems; 2)).ID /*Get 2nd last ID or Entry from Gallery */
}
);;
Patch(
UDID;
Defaults(UDID);
{
bel: DetScr_BEL.Text;
INTERNALID: DetScr_DrpdDwn_UServcie.Selected.INTERNALID;
from: DatePicker1.SelectedDate;
//until: DatePicker1_1.SelectedDate;
ChangeUser: User().FullName;
ID: Last(Sort(UDID;ID;SortOrder.Ascending)).ID + 1
}
);;Refresh(popup_overview_1);;Reset(Gallery1)
If you have any idea, that would be great.
I am not really a software engenieer and hope you have a good idea.
The two Semicolon are correct in this code because in germany there is no coma as seperator.
Regards
Sebi