Friday 26 October 2012

Date Conversion to string in Ax 2012

Hi Friends,

Today we will have a look at the date values and its conversion to string values in Ax 2012.

For Eg: We have a variable called Date d

We have assigned a value to it d = 20/07/1988



str Date2StrEasyLocal(date _date)
{
return ( date2Str
(_date,
321, // YMD
DateDay::Digits2,
DateSeparator::Hyphen,
DateMonth::Digits2,
DateSeparator::Hyphen,
DateYear::Digits4) );
}


str s = Date2StrEasyLocal(d);

By the above way we can covert the dates in string values.

Vivek Chirumamilla

Tuesday 2 October 2012

Other Databse Connection using Ax 2009

hi friends,

Connection with other database can be established from Ax.

This database may not have connection with the database you are using.

By using ODBCConnetion(Other DataBase Connection) you can use it.

I have given a sample code and example of it.

static void dbODBCConnection(Args _args)
{
LoginProperty loginProp;
ODBCConnection conn;
Resultset resultSet, resultSetCount;
Statement statement1, statement2;
;

loginProp = new LoginProperty();
loginProp.setServer('172.16.0.999');
loginProp.setDatabase('AxDynamics2009RND');


conn = new ODBCConnection(loginProp);

statement1 = conn.createStatement();
resultSet = statement1.executeQuery("SELECT * from Attandance");

while (resultSet.next())
{
info(resultSet.getString(2));
}
}


happy daxing,

Vivek Chirumamilla