Wednesday, 23 December 2015

How to Create Check box in Contract Class for ssrs report

First create contract class
class SRSRDPCustTableContractClass 
{ 
Noyesid  check; 
} 
__
create below method in contract class
[DataMemberAttribute("Noyesid")] 
public AccountNum parmAccountNum(
Noyesid _Noyesid = check) 
{ 
check_Noyesid; 
return 
check; 
} 



In DP class
Class Declaration
[
SRSReportParameterAttribute(classStr(sampleclassContract)
]
public class sampleclassDP extends  SRSReportDataProviderBase
{
    tmptable  _tmptable ;
}

then in your process report

[SysEntryPointAttribute (true)]
public void processReport()
{
        sampleclasscontract         contract;
        noyesid                                 check;
        ;
        contract            = this.parmDataContract();
        check               = contract.parmAccountNum();
       //your logic below


}

Monday, 21 December 2015

filtering-drop-down-list-based for cust in ax 2012

http://ssrsax.blogspot.com/2012/05/filtering-drop-down-list-based-on.html

Wednesday, 16 December 2015

Multiselect in lookup field level in ax 2012

https://calebmsdax.wordpress.com/2012/12/20/x-code-to-identify-multiple-selected-records-in-grid/

Monday, 14 December 2015

Upload Image and save in selected folder using x++

private void daxErp_conImageExample()
{
    #define.jpeg('.jpg')
    #define.openMode("R")
    Dialog                  dialog;
    DialogField             dialogFileName;
    FileIoPermission        perm;
    FilePath                filePath;
    FileName                fileExt;
    FileName                fileName;
    Filename                fileNameWithPath;
    Bindata                 daxRead, daxSave;
    container               readPic;
    str                     daxBase64;
    ;

    dialog = new Dialog("DAX ERP TRAINING Example - Read, Save and Write Image to and from the container");
    dialog.addGroup("Picture file upload");
    dialogFileName = dialog.addField("fileNameOpen", "Select JPEG image file to import");
    dialog.run();

    if (dialog.run())
    {
        fileNameWithPath = dialogFileName.value();
        if(!fileNameWithPath)
            throw error("Filename must be filled");

        [filePath, fileName, fileExt] = fileNameSplit(fileNameWithPath);
        if (fileExt != #JPEG)
            throw error(strFmt("The extension %1 is not allowed.The correct extension should be %2.", fileext, #JPEG));

        perm = new FileIoPermission(fileNameWithPath, #openMode);
        if (perm == null)
        {
            throw error("No rights to perform this action");
        }

        perm.assert();
        daxRead = new BinData();
        daxSave = new BinData();

        if (daxRead.loadFile(fileNameWithPath))
        {
            // Reading and storing image into the container
            readPic = daxRead.getData();
        }
        CodeAccessPermission::revertAssert();
        // Writing the image to a file from the container
        daxSave.setData(readPic);
        daxBase64 = daxSave.base64Encode();
        AifUtil::saveBase64ToFile(@"D:\\imageOutput.jpeg", daxBase64);//Saving at destination                                                              //folder change your own path other wise you ill get error "Object                                                      //'CLRObject' could not be created"
    }
}

when you executed u ill get this dialogbox



select path and save in your system which given path in code
Note : change the destination Path to avoid to get the error as  "Object                                                      //'CLRObject' could not be created"

Wednesday, 9 December 2015

Find sum of values in table in ax 2012

static void tooogood(Args _args)
{
Sales _sales;
   select sum(cash) from _sales where _sales.field1 != "1";
    {
    info(strFmt("%1",_sales.cash));
    }
}

Friday, 4 December 2015

Create Customers using X++ Code

static void JobCreateCustomer (Args _args)
{
    CustTable                    custTable;
    NumberSeq                    numberSeq;
    Name                         name ='SouthSide Street LTDA';

    DirParty                        dirParty;
    DirPartyPostalAddressView       dirPartyPostalAddressView;
    DirPartyContactInfoView         dirPartyContactInfo;

    /* Marks the beginning of a transaction.
       Necessary to utilize the method numRefCustAccount() */
    ttsBegin;
    custTable.initValue();

   try
    {
       //CustTable
        numberSeq               = NumberSeq::newGetNum(CustParameters::numRefCustAccount());
        custTable.AccountNum    = numberSeq.num();
        CustTable.AccountNum    = '1030';
        custTable.CustGroup     ='020';
        custTable.Currency      ='BRL';
        custTable.PaymTermId    ='10DD';
        custTable.PaymMode      ='CHEQUE-01';

        custTable.insert(DirPartyType::Organization, name);

        //DirParty

        /* Creates a new instance of the DirParty class from an address book entity
           that is represented by the custTable parameter. */
        dirParty = DirParty::constructFromCommon(custTable);

        dirPartyPostalAddressView.LocationName      ='HeadQuarters ';
        dirPartyPostalAddressView.City              ='São Paulo';
        dirPartyPostalAddressView.Street            ='4th Avenue';
        dirPartyPostalAddressView.StreetNumber      ='18';
        dirPartyPostalAddressView.CountryRegionId   ='BRA';
        dirPartyPostalAddressView.State             ='SP';

        // Fill address
        dirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView);

        dirPartyContactInfo.LocationName    ='SouthStreet Contact Phone';
        dirPartyContactInfo.Locator         ='551291165341';
        //dirPartyContactInfo.Type          = LogisticsElectronicAddressMethodType::Phone;
        dirPartyContactInfo.Type = LogisticsElectronicAddressMethodType::Phone;
        dirPartyContactInfo.IsPrimary       = NoYes::Yes;

        // Fill Contacts
        dirParty.createOrUpdateContactInfo(dirPartyContactInfo);

        // Marks the end of transaction.
        ttsCommit;
    }
    catch(Exception::Error)
    {
       ttsAbort;

    }
}

Sunday, 22 November 2015

Selection Change method in List page interaction Class to enable and disable the Controls in List age Form

    public void selectionChanged()
{
    super();

    _Table_DIPL = this.listPage().activeRecord(queryDataSourceStr(DIPL_CUST, DIPL_cust_1));

//(Query name assigned for listpage form)
//(Datasource name which is in Query)

    if(_Table_DIPL.ID == "ID7")
    {
     this.listPage().actionPaneControlEnabled(formControlStr(DIPLCUSTLISTPAGE, DeleteCommandButton),true);
//Form Name
//form field name
    }
    else
    {
    this.listPage().actionPaneControlEnabled(formControlStr(DIPLCUSTLISTPAGE, DeleteCommandButton),false);
    }
}

Thursday, 12 November 2015

filtering the data(record) based on selected Input

For filtering a particular record    :

1.First create a table  i.e tabcust  with fields name , ids(baseenum) ,  phno , height , weight
2.create a form and drag the table tabcust into data source.
in design take a grid and a combo box   give enum type as baseenum1;
  1. In class:
public class FormRun extends ObjectRun
{
QueryBuildRange qbr2;  //  declartion of range variable
}

  1. In Data source level . Override a method init()
    public void init()
    {
    super();
    qbr2 = this.query().dataSourceName(“tabcust”).addRange(fieldNum(Tabcust , BaseEnum1));
    }
5.in combo box – in methods override a selectionchange method()
public int selectionChange()
{
int ret;
ret = super();
Tabcust_ds.executeQuery();
return ret;
}

  1. Create a range by  overriding method executequery() in data source level: 
public void executeQuery()
{
qbr2.value(combobox.valueStr());
super();
}

Filter record

Learn EP

Hi Readers, 

Recently I worked on EP User Controls web part for Microsoft Dynamics AX 2012, and in this post I am giving you an example, which helps you to know about how we can create and deploy the user controls in EP site for Microsoft Dynamics AX 2012.

But before that, please ensure the following prerequisite you will need to complete the user control
  • Microsoft Dynamics AX 2012 with Enterprise Portal & Visual Studio Tools
  • Visual Studio 2010

1) Start with Visual Studio, VS 2010 is use to create user controls for EP, so first we have to create EP Web Application project..
  • Start VS 2010
  • Click on File> New> Project
  • Click on "Microsoft Dynamics Ax" under the "Installed Templates" tab
  • Click on "EP Web Application" and click on OK button
 

2) Now you can see "EPWebDevelopment1" Project in solution explorer

 

3) Now we have to add new item to create user control
  • Right click on the EPWebApplication1 at solution explorer
  • click on Add > New Item..
 
  • Click on Microsoft Dynamics Ax under the "Install Templates" tab then select "EP User Control" from list of template at right panel and click on "Add" Button
  • Now you have "WebControl1.ascx" file with two other sub-files in your project at solution explorer
 

4) Now Double click on WebControl1.ascx file and then click on Design from three option, you can find at bottom of central panel




















"At Design level you can add different types of AX control from the toolbox toolbar under the Dynamics Ax tab like MultiSection, Section, MultiColumn, Column, DataSource, Grid, Group etc..."

5) Click on toolbox toolbar, under the Dynamics Ax tab click on AXDataSource control

 
"AXDataSource Control needs DataSet to load the data from Dynamics Ax for User Control, make a new dataset as per your requirement and use that dataset here"

"Here I am using CustomerList dataset"

6) Now select AXMultiSection control from toolbox, in that AXMultiSection put AXSection control from the toolbox then it is look like below image

 

7) Now select AXGridView control from the toolbox and select the "AxDataSource1" data source for the grid from the context menu of control like below image


 

8) Now we have to select the field from the table which we want to show on that grid
  • click on the "Edit Columns.."  from the context menu of grid control to open "Bound Field Designer" 

  • Add required field from Available fields box to selected fields box, for every selected field if you need to set the properties, you can set from right portion property box
  • click on OK button and all selected fields appears on the grid
9) Click on "SAVE" button and the right click on "EPWebApplication1" Project and click on Add EPWebApplication1 to AOT button

Congratulate your EP User Control is ready to Deploy on EP friends..  

  • Open the Microsoft Dynamics AX client with administrative privileges. To do this, you must right-click on the icon for Microsoft Dynamics AX and then click Run as administrator 

  • Open the Development Workspace
  • Display the AOT
  • In the AOT, expand the Web > Web Content > Managed node. This node contains all of the User Controls that have been defined for Enterprise Portal
  • In the list of managed components, locate the WebControl1 node. This is the managed content node for the User Control that you just created

  • Right-click the WebControl1 node, and then click Deploy to EP

  • The Deploy to EP dialog box is displayed. Set the Web module lookup to Home\Sales to indicate that the new resources will be used in the Sales site for Enterprise Portal. Click OK

  • Microsoft Dynamics AX creates a SharePoint page named WebControl1 that is located in the Sales site. This page contains the customer list User Control that you created. Microsoft Dynamics AX also creates a web menu item named WebControl1 that points to the new page. Click Close to close the Infolog