Sql code to RDP (X++)

Here’s my sql code :

CASE WHEN DATEDIFF(D,GETDATE(),DATEADD(D,NUMOFDAYS,B.DELIVERYDATE)) >= 1 AND DATEDIFF(D,GETDATE(),DATEADD(D,NUMOFDAYS,B.DELIVERYDATE)) <= 7

THEN C.PURCHPRICE ELSE 0 END ‘-1 to -7 Days’,

please help me on this…

I will used if else if syntax instead of case.

Thank you in advance

up

94 views no REPLY …

please…

It may be caused by the fact that you forgot to explain your problem.

ok sorry…

my problem is,

its hard for me to convert my sql code to x++…

and now I’m trying to use expression in SSRS…

can you help me to convert sql code to expression …

please …

Please tell us which part you’re struggling with. You may not know how to add dates to a date, how to subtract date or who knows what. Maybe you should show us your current code.

Why did you originally decided to use X++ and why have you suddenly switched to Visual Basic?

Hi Martin

Actually lack of references in X++ in Ax 2012

so that i decide to ask question here to help me construct or create code in Ax 2012 …

im both using SSRS in Visual Studio and AX 2012 because i need to create REPORT in AX 2012.

Hope you Understand.

Let me ask one more time: which part of the SQL snippet you aren’t able to convert to X++/Visual Basic?

If.you wait for somebody to do all work for you, don’t be surprised that nobody bothers to answer. Show us that you actually tried to do it by yourself and where you got stuck.

Hi Martin,

DATEDIFF(D,GETDATE(),DATEADD(D,NUMOFDAYS,B.DELIVERYDATE))

adding number of days which is Terms of payment to Date of delivery and subtract in date today.

really don’t know how do that in X++

Assuming that DeliveryDate is a date and NumOfDays is an int, you can simply add them together (d.DeliveryDate + d.NumOfDays).

You can subtract days with the - operator (date1 - date2).

Please get used to consulting AX documentation on regular basis, before you get familiar with basics of X++. This particular topic is explained in Dates [AX 2012].

okay tnx …

but i know that formula.

got confuse because deliverydate is column of one of my table and also numofdays.

and got trouble creating the code when do the formula.

That’s why I wanted you to explain the problem. If you fail to do that, don’t be surprised that you don’t get the answer you actually wanted. Please remember it when asking here in future.