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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Allow nulls for a new field in CustAgingReportTmp table

(0) ShareShare
ReportReport
Posted on by 55

Hello,

I’ve added new field to CustAgingReportTmp table but I don’t see any property to make it nullable. I get below error when inserting data. Could you please let me know how to make it nullable?

Regards,

Dumindu

SQL error description: [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot insert the value NULL into column 'AMS_EMPRES', table 'tempdb.dbo.t10601_664F13DD6A524F25B793C6A868104CEE'; column does not allow nulls. INSERT fails

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    AX doesn't support nullable fields.

    Please make sure that your DB is fully synchronized with the application and give us more information about the error. How exactly are you inserting the data, what are you inserting, what's the type of AMS_EMPRES and so on.

  • Dumindu Profile Picture
    55 on at

    Hi Martin,

    Thanks for the response. Then could you please let me know how to get below insert method done without loosing records.

    My requirement is to add Employee responsible to the Customer Aging Report. There was no error when use just join, without outer. But it drops customers without employee responsible from the report. If allow nulls is not an option, could you please let me know how to get this fixed?

    Thanks,

    Dumindu

    insert_recordset custAgingReportTmp

              (Balance01, Balance02, Balance03, Balance04, Balance05, Balance06, Balance07,

               Balance01cur, Balance02cur, Balance03cur, Balance04cur, Balance05cur, Balance06cur, Balance07cur,

               TransDate, InvoiceId, Voucher, AccountNum, Name, CustAccount, Txt, Currency, CustGroup, BillingClassification,

               AsOfDate, HeadingAccount, HeadingName, HeadingDate, Heading1, Heading2DateValue, Heading2,

               Heading3, Heading4, Heading5, Heading6, Heading7DateValue, Heading7, Heading8, Heading9,

               Heading10, Heading11, Heading12, Heading13, Heading14, HeadingAgingBucketDescription02,

               HeadingAgingBucketDescription03, HeadingAgingBucketDescription04, HeadingAgingBucketDescription05,

               HeadingAgingBucketDescription06, HeadingAgingBucketDescription07, Balance, SortOrder, AMS_EmpRes)

                   select

                       Balance01, Balance07, Balance06, Balance05, Balance04, Balance03, Balance02,

                       Balance01cur, Balance07cur, Balance06cur, Balance05cur, Balance04cur, Balance03cur, Balance02cur,

                       TransDate, InvoiceId, Voucher, AccountNum, Name, AccountNum, Txt, CurrencyCode, GroupId, BillingClassification,

                       asOfDate, headingAccount, headingName, headingDate, heading01, heading02, heading07Text,

                       heading03, heading04, heading05, heading06, heading07, heading02Text, heading011, heading03,

                       heading031, heading041, heading051, heading061, heading061, headingAgingBucketDescription02,

                       headingAgingBucketDescription03, headingAgingBucketDescription04, headingAgingBucketDescription05,

                       headingAgingBucketDescription06, headingAgingBucketDescription07, balance

                   from tmpAccountSum

                           join SortOrder

                           from custVendTransAging

                               where tmpAccountSum.AccountNum == custVendTransAging.AccountNum

                               outer join  AMS_tmpCustTable where AMS_tmpCustTable.AccountNum == custVendTransAging.AccountNum

                               outer join AMS_tmpHCMWORKER where AMS_tmpHCMWORKER.recid == AMS_tmpCustTable.MainContactWorker

                               outer join NAME from AMS_tmpDirPartyTable where AMS_tmpDirPartyTable.recid == AMS_tmpHCMWORKER.PERSON;

  • Verified answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    Aha, I finally see what your problem is about. It would have helped if you explained your situation straight away, instead of talking about what you meant to be a solution (= making a field nullable).

    What you're describing is the correct behavior of inner joins; there is nothing that should be done about it. And you get the error because there is nothing returned by the outer join for some records.

    What you need is not making the field nullable, you would need a way to provide a default value (an empty string) when nothing is returned. Unfortunately I don't think you can do it with insert_recordset, therefore you'll have to look for a workaround. For example, you can leave insert_recordset without 'employee responsible' and update it by a separate update_recordset.

  • Dumindu Profile Picture
    55 on at

    Hi Martin,

    Many thanks for guiding me to the correct direction, I'll try your solution and get back to you if I couldn't get it sorted.

    Regards,

    Dumindu

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans