web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
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 636

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. 

  

I have the same question (0)
  • Suggested answer
    Leo Chen Profile Picture
    Microsoft Employee on at

    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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 689

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 455 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 308 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans