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;

    }
}