Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

How to split & insert transactions

(0) ShareShare
ReportReport
Posted on by 584

Hi Experts,

I have a requirement that in my Table I have some data that needs to be splitted by date & hours. Can anyone help me by providing the best way to achieve this please. 

Consider the table - MyTable has fields From date, To date, From time, To Time & hours. 

Consider the record - From Date           To Date              From Time        To Time            Hours

                                   23/05/2021        25/05/2021           10:00 am         12:00 am             38

I need to split above record into two records 14 hours for 23/05/2021 & 24 hours for 24/05/2021. There are around 10,000 records to be splitted in this way, what will be the best way to get it done ? AOT job, Class or SQL. Can any one help with the best logic also please.

Thanks in advance. 

  

  • Verified answer
    Leo Chen Profile Picture
    on at
    RE: How to split & insert transactions

    I believe you need to create your own class. And  2 key methods would be 

    1. Validate if a record needs to be split according to given From Time. Take your data as example, you need to compare the Hours on the record with rest time of a day according to the From time. In our case the rest time of a day would be 24- 10= 14. Since 38 > 14, this record needs to be split. The return outcome would be True. Else return false. 

    2. if #1 method returns true, then split current record to 2 ones. Parameter would be from date and from time. For the generated 1st record, the new From date would be the parameter value which is May 23. The hours should be rest time of a day based on from time, which would be 14 hours. For the generated 2nd record, The From date would be parameter value +1 which would be May 24. The from time should be 12:00am. The Hours should be rest hours which would be 38- 14 = 24 hours. 

    Once above 2 methods are ready, you need to continue to validate if the generated second record needs to be split or not. If yes, then go to the second method to continue split this record. So as you can this is a recursive funtion. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,137 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,877 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans