Thursday, 26 February 2015

Refresh Form Automatically After Specific Time Interval In AX2012

Hi Guys,

A requirement in which form automatically refresh after 10 minutes when client restrict without using of Batches functionality.I have achieved this requirement with following steps and share with all of you

All changes performed on Form level methods

Step 1: on class declaration level I have created a macro like this

public class FormRun extends ObjectRun
{
    #define.waitTime(10*60*1000)
}

Step 2: Create a new method at form level like following

void refreshForm()
{
    this.setTimeOut(identifierstr(refreshForm), #waitTime, false);
    DatasourceName_ds.research(true);
}

Step 3: In this step override run method on form level and your code look like following

public void run()
{
    super();
    this.refreshForm();
}

That's End.


Thursday, 30 October 2014

Optimizing display methods in AX 2012

Check the following link for detail of display method.what developer must be care before using it.

http://www.axpulse.com/optimizing-display-methods-in-ax-2012/
http://daxdude.blogspot.com/2013/05/dynamics-ax-cacheaddmethod.html

Wednesday, 24 September 2014

Debugging AIF services of Microsoft Dynamics AX 2012 in Visual Studio

If do you want to debug AIF service's in VS  checked following useful links

http://dynamicsaxsol.blogspot.com/2013/06/debugging-aif-services-of-microsoft.html


http://daxdilip.blogspot.in/2010/05/aif-links.html

Thursday, 19 June 2014

Read data from live website in Ax2012

With the help of following code we can easily read data from live website

static void ReaddataFromLivewebSite(Args _args)
{
    #DEFINE.BLOGCONTENT('http://www.lme.com/en-gb/metals/non-ferrous/copper/')
    int         curPos=1;
    int         endPos;
    int         startPos=1;
    str         data;
    str         internetURL;
    int         price;
    TextBuffer  textBuffer;
    System.Net.WebRequest request;
    System.Net.WebResponse response;
    System.IO.StreamReader  streamReader;

    request=System.Net.WebRequest::Create(#BLOGCONTENT);
    response= request.GetResponse();
    streamReader=new System.IO.StreamReader(response.GetResponseStream());
    textBuffer =new TextBuffer();
    textBuffer.setText('');
    data = streamReader.ReadToEnd();
    streamReader.Close();
    textBuffer.setText(data);
    textBuffer.regularExpressions(false);
    textBuffer.find('Cash Seller & Settlement', curPos);
    startPos=textBuffer.matchPos();
    textBuffer.find('3-months Buyer');
    endPos=textBuffer.matchPos();
    data=textBuffer.subStr(startPos, endPos - startPos);
    data =   strReplace(data,'',"");
    data =   strReplace(data,'',"");   
    data =   strReplace(data,' ',"");
    data =   strReplace(data,'',""); 
    internetURL= strRem(strreplace(data,'Cash Seller & Settlement',''),'"');
    price = str2int(internetURL);
    internetURL = int2str(price);
    info(internetURL);
    response.Close();

}

Tuesday, 10 June 2014

Calculate LabelIds against Label field Id in AX2012 using X++

I have calculated a total number of label id's against Label file id . In my case Label file Id is "NVS".

static void maxLabelIds(Args _args)
{
    SysLabel   SysLabel;
    int maxLabelId;
    ;
    SysLabel =  new SysLabel('EN-US');
    maxLabelId = SysLabel.maxLabelId('NVS');
    print maxLabelId;
    pause;
}

Saturday, 17 May 2014

Using AIF Inbound and Out Bound service check Exception in Ax2012



I used AIF inbound service when any error occurred in AIF. Errors did not  shown in exception window of AIF. Errors must be looks like a following screen but in my case it's shown empty.













Solution:
In my scenario
few lines of code is missing inside this class i.e "AxdLedgerGeneralJournal" in method of "prepareForSave" those lines are following


Find a char in string and replace new char using x++ in Ax2012


In following example we are find a char i.e "," in string and replace this char with new one char i.e ".".

static void FindCharAndRepalce(Args _args)
{

    str a;
    int pos;
    ;
 
    a     = "100,00";
    pos =  strFind(a, ',',1, strLen(a));
    a     =  strDel(a,pos,1);
    a     =  strIns(a,'.',pos);
    info(strFmt("%1",a));
}