Thursday, 10 March 2016

Collapse/Expand in SSRS

1. Select the row for which collapse/expand has to be set and select row visibilty
set the properties as shown in the screen shot below
















In Screenshot SubtotalGrp is the textbox name of the above row(+/- button will appear) on which collapse/expand should work.

Sunday, 21 February 2016

To import a new model file in AX

1.Open Microsoft Dynamics AX Management Shell(Run as administrator) from Administrative tools
2. Run the following command in PS C:\Windows\system32>

Install-AXModel -File "C:\Users\sbandy\Desktop\Suneela\Direct_Energy_AX\Merged Models\6.STOPurch_CUSTOM" -Details



Tuesday, 2 February 2016

To run different designs in controller class

1. In main method 
static void main(Args _args)
{
    DESVendorSpendReportController controller;


    controller = new DESVendorSpendReportController();
    controller.parmReportName(ssrsReportStr(DESVendorInvoiceSpendReport, Reporting));
    controller.parmArgs(_args);

    controller.startOperation();
}
2. in PreRunModifyContract class
Protected void preRunModifyContract()
{
    DESVendorSpendReportContract   contract;
    NoYesId                        LE;
        super();
    contract   = this.parmReportContract().parmRdpContract() as DESVendorSpendReportContract;
    LE         = contract.parmsubtotalByLegalEntityAndVendor();
   
    if (LE )
    {
                            this.parmReportContract().parmReportName(ssrsReportStr(DESVendorInvoiceSpendReport,LEInvDateReporting));
    }
    }

Monday, 25 January 2016

Loopkup filter  based on another field  in SYSQUERY form 

The requirement is to filter one lookup field value based on another field selection in SysQuery form.

Follow the below steps to filter VendorAccount field based on legal entities selection

Example:

1. Create a new Query called DESVendorSpendReport having DataArea as Root and VendTable underneath it.
create a relation under VendTable like DataArea.id == VendTable.DataAreaid
2. Set AllowCrossCompany property of the Query to true.
3. Write the below code in SysQueryForm > Range(DataSource) > RangeValue(field) > Lookup method

public void lookup(FormControl _formControl, str _filterStr)
{

   CompanyInfo          companyInfo;
   Query                query;
   QueryBuildDataSource qbds;
   SysTableLookup       lookup;
   SysDictField         sysDictField;
   VendTable            vendTable;
   TmpSysQuery          tmpSysQuery;
   TmpSysQueryCompanyRange tmpSysQueryCompanyRange;
   Container               selectedCompanies;
   
   ;
   sysDictField = new SysDictField(Range.Table_Id, Range.Field_Id);
   if (sysDictField.label() == "Vendor account")
   {
        recordsMarked = CompanyRanges_DS.recordsMarked();
        lastIndex     = recordsMarked.lastIndex();

        for (tmpSysQueryCompanyRange = CompanyRanges_DS.getFirst(); tmpSysQueryCompanyRange ; tmpSysQueryCompanyRange = CompanyRanges_DS.getNext() )
        {
            if (tmpSysQueryCompanyRange.IsCompanySelected == NoYes::Yes)
            {
                selectedCompanies = conIns(selectedCompanies, 1, tmpSysQueryCompanyRange.CompanyId);
            }
        }

        if (selectedCompanies)
        {
            lookup = SysTableLookup::newParameters(tableNum(DESVendorSpendReport),                      _formControl);
            lookup.addLookupfield(fieldNum(DESVendorSpendReport, AccountNum));
            lookup.addLookupfield(fieldNum(DESVendorSpendReport, Id));

            query = new Query();

            qbds = query.addDataSource(tableNum(DESVendorSpendReport));
            qbds.addRange(fieldNum(DESVendorSpendReport, id)).value(con2Str(selectedCompanies));
            lookup.parmQuery(query);

            lookup.performFormLookup();
          }
      else
      {
        SysLookup::lookupRange(_formControl, range, sysQueryForm.query());
      }
   }
   else
   {
     SysLookup::lookupRange(_formControl, range, sysQueryForm.query());
   }

}

Parallel compile through command prompt 

1. change the directory to the path where axbuild.exe file exits
Eg : cd E:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin
2. Run the following command
Eg: E:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin>axbuild.exe xppcompileall /aos=01 /altbin="E:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin" /workers=6


Wednesday, 9 December 2015

To Export a model using command prompt:

1. Open command prompt as run as administrator
2. change the directory to management utilities 
for ex: if the managementUtilities are present in E:\Program Files\Microsoft Dynamics AX\60\ManagementUtilities
3. change directory to E drive using cd E:
4. once the directory is changed enter the command E:> E:\Program Files\Microsoft Dynamics AX\60\ManagementUtilities
5. E:\Program Files\Microsoft Dynamics AX\60\ManagementUtilities> axutil export /model:DES /file:BPCheck (where DES is the existing model and BPCheck is the filename we need to export) 
Finally the model will be exported to E:\Program Files\Microsoft Dynamics AX\60\ManagementUtilities.

Friday, 4 December 2015

To Find the phone number of the customer:


    LogisticsElectronicAddress LogisticsElectronicAddress;
    DirPartyLocation DirPartyLocation;
    int contactPhoneCounter = 0;

    while select Locator from LogisticsElectronicAddress exists join DirPartyLocation
    where
    DirPartyLocation.Party == _custInvoiceJour.custTable_InvoiceAccount().Party
    &&
    DirPartyLocation.location == LogisticsElectronicAddress.location
    && LogisticsElectronicAddress.type == LogisticsElectronicAddressMethodType::Phone
    {
        contactPhoneCounter++;
        if (contactPhoneCounter==1)
        {
                cachedCompanyContactPhone1 = LogisticsElectronicAddress.Locator;
        }
        else if (contactPhoneCounter==2)
        {
            cachedCompanyContactPhone2 = LogisticsElectronicAddress.Locator;
        }
        else
        {
            break;
        }
    }