As you seen above mentioned picture i.e. the table(LeaveHistory) record's Pic ,
In record pic I have applied for the leave 1/8/2022(from_date)(Session1)-3/8/2022(to_date)(session2) Basically I just want to break this record into three entries for example:
01-08-->01-08=1 day (Full day leave) S1-S2
02-08-->02-08=2 days (full day leave)S1-S2
03-08-->03-08=0.5 day (half day leave)S1-S1
Here, S1= Session1& S2= Session2
I hope you all now understand my problem, so is there any way to split the record as per the requirement.
Thanks.
Hi @goel_gagandeep ,
Just to clarify if I understood this right.
1) You want to check all records in your Table - LeaveHistory.
2) Split the record - for example if date FromDate 01.08 ToDate 02.08 , also split the days so if NumOfDays - 2 then there will be 2 records now : 01.08 as NumofDays - 1 and 02.08 NumofDays - 1?
_____________________________________________________________________________________
Please give a thumbs up if I resolved your issue! Please click Accept as Solution to close the topic!
Yes @Gochix , I want the same as per your understanding, so do you have any solution for this?
Here is a quick code before work.
You would need to adjust the logic to calculate dates for old and new record.
A logic to calculate NumOfDays based on the record.
But it's a start for you to finish the code for your own needs.
ClearCollect(NewSessionRecords,YourData);
ForAll(NewSessionRecords As aRecord,
With({aLookup: LookUp(YourData, Id = aRecord.Id)},
If(DateDiff(aLookup.FromDate,aLookup.ToDate),
Patch(YourData, Defaults(YourData),
{
EmployeeId: aRecord.EmployeeId,
FromDate: aRecord.FromDate+1,
ToDate: aRecord.ToDate-1,
NumOfDays:1
}
);
Update(YourData,aLookup,
{
EmployeeId:aRecord.EmployeeId,
FromDate:aRecord.FromDate,
ToDate:aRecord.ToDate-1,
NumOfDays:aRecord.NumOfDays-1
})
)
)
);
_____________________________________________________________________________________
Please give a thumbs up if I resolved your issue! Please click Accept as Solution to close the topic!
User | Count |
---|---|
261 | |
129 | |
99 | |
48 | |
47 |