June 29, 2013

Getting number of rows loaded

Getting number of rows loaded

To get the number of rows loaded to the Dynamics AX datasource query, you can use the following code which is default function of the datasource.

[datasource].numberOfRowsLoaded();
For example:
custTable_ds.numberOfRowsLoaded();


-Harry

June 27, 2013

Application Integration Framework Overview

Application Integration Framework Overview

Application Integration Framework (AIF) is the infrastructure within Microsoft Dynamics AX with which you can expose business logic or exchange data with other systems. AIF is comprised of three primary components:
  • Services - Enable you to expose business logic written in X++ as a service to be consumed by other applications. Within Microsoft Dynamics AX, you can create, customize, and publish services.
  • Document services - A specific implementation of services in which the Microsoft Dynamics AX business logic is exposed through document services.
  • Consume Web services - In Microsoft Dynamics AX, you can consume external Web services from your X++ code.

    For origional post follow below link
    -Harry

June 20, 2013

Creating Vendors through X++ in AX 2012- PART V

Creating Vendors through X++ in AX 2012- PART V

--Create bank details for the vendor--

private void createBankDetails(WI_VendorRequestCreate          _vendorRequestCreate,
                               VendAccount                     _vendAcc)
{
    VendBankAccount         vendBankAccount;
    LogisticsLocation       lLogisticsLocation;
    LogisticsPostalAddress  logisticsPostalAddress;
    ;
ttsBegin;
    lLogisticsLocation.Description      = _vendorRequestCreate.FirstName;
    lLogisticsLocation.insert();
    logisticsPostalAddress.Street       = _vendorRequestCreate.VendBankAddress;
    logisticsPostalAddress.Address      = _vendorRequestCreate.VendBankAddress;
    logisticsPostalAddress.Location     = lLogisticsLocation.RecId;
    logisticsPostalAddress.insert();
    vendBankAccount.AccountID           = subStr(_vendorRequestCreate.BankAccount,1,10);
    vendBankAccount.Name                = _vendorRequestCreate.BankAccount;
    vendBankAccount.AccountNum          = _vendorRequestCreate.BankAccountNum;
    vendBankAccount.VendAccount         = _vendAcc;
    vendBankAccount.CurrencyCode        = _vendorRequestCreate.CurrencyCode;
    vendBankAccount.BankGroupID         = BankAccountTable::find(vendBankAccount.AccountID).BankGroupId;
    vendBankAccount.Location            = lLogisticsLocation.RecId;
    vendBankAccount.WI_BeneficiaryName  = _vendorRequestCreate.BeneficiaryName;
    vendBankAccount.initFromBankGroup(BankGroup::find(vendBankAccount.BankGroupID));
    vendBankAccount.insert();
ttsCommit;
}

Check below posts for more details


-Harry

June 17, 2013

Use resource files in Axapta

Use resource files in Axapta

In Application Object Tree, you can find resources node.
Select resources node and right click; select Create from File, specify the file location for the new resource file. After that you can use this resource file in Axapta without specifying an absolute file path in your local/server system.

First, pick up the resource node from AOT;


SysResource::getResourceNode();

Then generate a temporary file for this resource file;

SysResource::saveToTempFile()

Finally specify the temporary file path for controls.
Here comes an example to show how to use a resource file as a background image of  a given form.

{
ResourceNode            resourceNode;
FilePath  imagename;
;
resourceNode = SysResource::getResourceNode(resourcestr(ResourceName));
if (resourceNode)
{
resourceNode. AOTload();
imagename =  SysResource::saveToTempFile(resourceNode);
}
else
{
throw Error(“No file exists.”)
}

element.design().imageName(imagename);
}

You can try This also
Add a resource file in Resource node under AOT, Right click on Resource Node -> select "Create From File"



Select a file  from your your local drive.



 You can change the label and name of this file as require.














To use this image file in your code just add following code 

SysResource::getResourceNodeData(SysResource::getResourceNode('theaxapta_File'));

Enjoy.......

-Harry