Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Select SUM Nvarchar

Posted on by Microsoft Employee

Hello everyone!

I need your help..

I have a SUM select query but the data type is NVARCHAR. in mssql it is recommended to use CAST, what if on AX?

select TransId,PRODUCTID,Sum(Cast(Qty As Decimal(10,2))),Sum(Cast(QTYSCAN As Decimal(10,2)),TransType 
from TempBarcode1
group by TempBarcode1.TransId,TempBarcode1.PRODUCTID,TempBarcode1.TransType
where TempBarcode1.TransType == 'PickingListRegistrasi' &&
TempBarcode1.TransID == SalesParmTable.SalesId

Thanks!

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Select SUM Nvarchar

    thank's sir, I'm Try

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Select SUM Nvarchar

    thank you sir, I understand, but this data has been used on some ax modules

  • Martin Dráb Profile Picture
    Martin Dráb 230,214 Most Valuable Professional on at
    RE: Select SUM Nvarchar

    If you store Qty as string, the key problem in in your data model. You'll be able to query the data easily when you switch to the right data type.

  • Suggested answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Select SUM Nvarchar

    You cannot do this in AX, so either store it as a decimal or change it to while select and convert to real inside of the loop.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans