Report

Hi,

I m creating one report in Ax-2009. In this I have to take one date before in compare to created date.I m trying as per below date…But it is giving error(Operand types are not compatible with the operator.). Table is Purch Line

if(PurchLineLoc)
{

if(PurchLineLoc.PurchPrice != PurchLine.PurchPrice)
{

Endate =CLRInterop::getObjectForAnyType(PurchLineLoc.createdDateTime-1);

break;
}
else
{
if(PurchLineLoc.RecId == PurchLine.RecId)
Endate = systemdateget();
else
continue;
}
}

I want Like this

Endate = PurchLineLoc.createdDate-1;

Plz help…

Hello Shankar,

In the below piece of code:


if(PurchLineLoc.PurchPrice != PurchLine.PurchPrice)

{

Endate = CLRInterop::getObjectForAnyType(PurchLineLoc.createdDateTime-1);


I can see the incompatibility between the primitive data types “Date” and “Utcdatetime”.

“endDate” variable is of type “Date” while the field “createdDateTime” in the PurchLineLoc table variable is of type “Utcdatetime”.

What you can do is use the method of the DateTimeUtil class to convert “Utcdatetime” type to “Date” type as shown below:

endDate = DateTimeUtil::date (PurchLineLoc.createdDateTime) - 1;

This way you will get the desired result.

Thanks & Regards,

Shankar Dutt Sharma

Thanks Shankar…Its working