September 07, 2013

How to compare UTCDATETIME with DATE only in reports Filter

How to compare UTCDATETIME with DATE only in reports Filter


Some time we need to companre UTCDateTime with DATE datatype. Generally we faced this issue during reports dialog box.
here is a the solution to compare the UTCDateTime and DATE datatypes in axapta.


public class ReportRun extends ObjectRun
{
    DialogField             DialogFromDate;
    DialogField             DialogToDate;
    DialogField             DialogPaymId;
    UtcDateTime               FromDate;
    UtcDateTime               ToDate;
    Name                    PaymId;

}

public boolean getFromDailog()
{
        ;
        fromDate    = clrSystemDateTime2UtcDateTime(dialogFromDate.value());
        todate      = clrSystemDateTime2UtcDateTime(dialogTodate.value() + 1);
        PaymId      = DialogPaymId.value();
        return true;
}

-Harry

Error when accessing form “BI generation options”

Error when accessing form “BI generation options

I got a error when i click on following link
Administration > Setup > Business analysis > OLAP > BI generation options
Cannot execute the required database operation. The SQL database has issued an error and in Application event viewer on AOS server you can find following entry The database reported (session 3 (Admin)): 
[Microsoft][SQL Native Client][SQL Server]Invalid column name 'usergroup3'.. 

The SQL statement was: 
DELETE FROM [DBO].BIUDMROLES WHERE USERGROUPID IN  usergroup1,usergroup2,usergroup3)"

Possible Reason:
The problem is caused by minor bug in Classes\ SrsStatementQuery method deleteInvalidBIUdmRoles() Right now the while looks like:

while select udmRoles
{
   select userGroupInfo where userGroupInfo.Id == udmRoles.UserGroupId;
   if (!userGroupInfo)
   {
      if (strlen(list) > 0)
     {
        list += #comma;
     }
     list += udmRoles.UserGroupId;
  }
}


Suggested Solution:
while select udmRoles
{
   select userGroupInfo where userGroupInfo.Id == udmRoles.UserGroupId;
   if (!userGroupInfo)
   {
      if (strlen(list) > 0)
     {
        list += #comma;
     }
list +="'"+ udmRoles.UserGroupId+"'";
  }
}

-Harry