microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
728 stars 241 forks source link

. Arithmetic operation resulted in an overflowin Match-Based Coupling #7458

Closed HenrikKjelgaard closed 1 year ago

HenrikKjelgaard commented 1 year ago

1. Describe the bug Issue with Standard functionality when trying to make a Match-Based Coupling on a table where the number of records in Source Company multiplied with the number of records in Subcriber exceeds the max value of an Integer. image

2. To Reproduce Steps to reproduce the behavior: We need at recordset at approx. 50.000 records, so it's necessarry to create that first in Cronus. InMy example it's Default Dimensions.

  1. Go to '...'
    • In Cronus Demo Company create a function to create 50.000 new Items, make every 1 out of 1000 blocked.
    • Make a Copy of Cronus an set activate Master Data Management with Cronus as Source Company.
    • Insert a New Synchronization Table. Select Item as Table, and add a Table filter with Blocked = false.
    • Run Match-Based Coupling in Foreground, and the error will appear.

3. Expected behavior I'm not quite sure about the reason for the condition that causes the error. In codeunit 7235 "Master Data Mgt. Table Couple" local procedure CoupleRecords if (Format(MatchingIntegrationRecordFieldRef.Value()) <> '') or *(LocalRecordRefCount IntegrationRecordRefCount = 1) then begin If we are checking that there only is 1 record in both Subscriber Company (LocalRecordRefCount) and Source Company IntegrationRecordRefCount, then the Condition could be changed to; "or (LocalRecordRefCount = IntegrationRecordRefCount = 1)** then"

If the intention is to check if there are an identical number of records in Source and Subscriber then the Condiftion could be changed to; "or (LocalRecordRefCount / IntegrationRecordRefCount = 1) then"

or "or (LocalRecordRefCount = IntegrationRecordRefCount) then"

4. Actual behavior The "Arithmetic operation resulted in an overflow" should not happen. 5. Versions:

Final Checklist

Notice that this is my first attempt to report a bug. Any feedback on how to improve is much appreciated. Please remember to do the following:

pri-kise commented 1 year ago

This issue doesn't belong to this repository, since it isn't related to the AL Language Extension.

Additionally I'm unable to find this piece of code in the latest BC22.3 version. You should check your problem with the latest available version.

HenrikKjelgaard commented 1 year ago

Thanks for your reply pri-kise. It's actually a part of on of Microsofts -Excude apps, and because of that it's necessarry to add the following depenidency to the app.json file, to view the code. "dependencies": [ { "id": "a01864f8-9c3f-42f6-8328-8d7be1ce3e20", "name": "_Exclude_Master_Data_Management", "publisher": "Microsoft", "version": "22.2.56969.57617" }

],

pri-kise commented 1 year ago

@HenrikKjelgaard could you please check the latest version: https://github.com/StefanMaron/MSDyn365BC.Code.History/blob/1fde78466cb801d07441756796abea59afd793ba/MasterDataManagement/Source/_Exclude_Master_Data_Management/src/codeunits/MasterDataMgtTableCouple.Codeunit.al#L156C49-L156C49

I'm unable to find the mentioned issue in the latest version.

HenrikKjelgaard commented 1 year ago

@pri-kise You are absolutely rigtht, it was fixed in the latest version, thanks for sharing :-) image Br. Henrik

HenrikKjelgaard commented 1 year ago

Fixed in version 22.3.58346.58475