Friday, 25 November 2016

Query lookup in ax 2012 using x++ code


Query lookup in ax 2012 using x++ code


public void lookup()
{
    Query                   query;
    QueryBuildDataSource    vendTable;
    QueryBuildRange         range;
    SysTableLookup          sysTableLookup;

    query               = new Query();
    vendTable           = query.addDataSource(tableNum(VendTable));

    range               = vendTable.addRange(fieldNum(VendTable, AccountNum));
    range.value("INMF-000001");//here we can pass range

    sysTableLookup = SysTableLookup::newParameters(tableNum(VendTable), this);

    //here true is used for getting accountNum only.
    sysTableLookup.addLookupfield(fieldNum(VendTable, AccountNum),true);

   //here we can get the method like this way.
    sysTableLookup.addLookupMethod(tableMethodStr(VendTable, Name));
    
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}

Args Lookup methods in AX 2012 using X++ code



Args Lookup methods in AX 2012 using X++ code


public void lookup()
{
    Args     args;
    Object  formRun;
    ;
    super();
    args = new Args();
    args.caller(this);
    args.name(formStr(VendTableLookup));//VendTableLookup is a form calling for lookup purpose
    args.lookupField(fieldNum(VendTable, AccountNum));
    args.lookupValue( "");// here you can pass the value

    formRun = classfactory.formRunClass(args);
    formRun.init();
    this.performFormLookup(formRun);
}

or

public void lookup()
{
    super();
    VendTable::lookupVendTable(this);
}

Monday, 21 November 2016

[Microsoft][SQL Server Native Client 11.0]Unspecified error occurred on SQL Server. Connection may have been terminated by the server


 [Microsoft][SQL Server Native Client 11.0]Unspecified error occurred on SQL Server. Connection may
have been terminated by the server



Object Server 01:  The database reported (session 1 (-AOS-)): [Microsoft][SQL Server Native Client 11.0]Unspecified error occurred on SQL Server. Connection may
have been terminated by the server.. The SQL statement was: "SELECT COUNT(T1.TZENUM) FROM TIMEZONESLIST T1"


While i am going to start the server its showing me a warning message.

I went to event viewer, reason for not starting the server. It showing the below issues.




I Opened the SQL database and checked.

Here the "TimeZonesList" table is corrupted. So, I delete the table.

After that, i copy and paste this code in the database and Execute this command for re-creation same table.
Got a message completed successfully.


CREATE TABLE [dbo].[TIMEZONESLIST](
[TZENUM] [int] NOT NULL DEFAULT ((0)),
[TIMEZONEKEYNAME] [nvarchar](64) NOT NULL DEFAULT (''),
[ENUMNAME] [nvarchar](64) NOT NULL DEFAULT (''),
[ENUMPOSITION] [int] NOT NULL DEFAULT ((0)),
[RECVERSION] [int] NOT NULL DEFAULT ((1)),
[RECID] [bigint] NOT NULL,
 CONSTRAINT [I_65496TZENUM] PRIMARY KEY CLUSTERED 
(
[TZENUM] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO


as picture as below.










After then start the service. It will work fine.


Thank You.

Wednesday, 9 November 2016

Example of Macros in ax 2012

Example of Macros in ax 2012


You can create a temporary text message using like this


here the TestMacro is not present in Macro node in ax 2012

i created a temporary Macro 

from this i called Macro and getting the information using like this...

static void TestMacro(Args _args)
{
    #define.test("Hai hello how do you do?")
    
    info(strFmt("%1",#test()));
}

Thank you.

Monday, 7 November 2016

Exception from HRESULT: 0xC0048021 at Microsoft.Dynamics.AX.Framework.Tools.DMF.SSISHelper.DMFEntity.ShowPreview(Boolean isComposite)




My title


page contents



Exception from HRESULT: 0xC0048021 at Microsoft.Dynamics.AX.Framework.Tools.DMF.SSISHelper.DMFEntity.ShowPreview(Boolean isComposite)


If you're using Excel 2013 like I am, the problem is caused by DMConfig XML file.
Go to the DMConfig.xml file in the 
C:\Program Files\Microsoft Dynamics AX\60\DataImportExportFramework folder and replace the 
PipelineComponentInfo_Multicast, 
PipelineComponentInfo_ExcelSource, 
PipelineComponentInfo_ExcelDestination nodes by the following:
<PipelineComponentInfo_Multicast>
    {33D831DE-5DCF-48F0-B431-4D327B9E785D}  </PipelineComponentInfo_Multicast>
  <PipelineComponentInfo_ExcelSource>
    {9F5C585F-2F02-4622-B273-F75D52419D4A}
  </PipelineComponentInfo_ExcelSource>
  <PipelineComponentInfo_ExcelDestination>
    {90E2E609-1207-4CB0-A8CE-CC7B8CFE2510}
  </PipelineComponentInfo_ExcelDestination>
It will solve the issue.
Thank you