Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Sunday, February 23, 2014

How to give 3 fields in look up with filtering one with previous field in Dynamic AX 2012


1.      Create 3 fields for the table “FormTable” and add to form datasource.
2.      First field with relation in table level so automatically you will get the look up.
·         As FormTable.Fild1
3.      Second field with following lookup code, this look up filter with previous field.
·         As FormTable.Fild2
Public void lookup ()
{
    Query                   query = new Query();
    QueryBuildDataSource    queryBuildDataSource;
    QueryBuildRange         queryBuildRange;
     QueryBuildRange         queryBuildRange1;
    SysTableLookup          sysTableLookup;
     HRCCompGrid                  HRCCompGrid;
    ;
    //Create an instance of SysTableLookup with the form control passed in
    sysTableLookup = SysTableLookup::newParameters(tablenum(HRCCompRefPointSetupLine), this);
    //Add the fields to be shown in the lookup form
    sysTableLookup.addLookupfield(fieldnum(HRCCompRefPointSetupLine, RefPointId));
    sysTableLookup.addLookupfield(fieldnum(HRCCompRefPointSetupLine, RefPointSetupId));
    //create the query datasource
    queryBuildDataSource = query.addDataSource(tablenum(HRCCompRefPointSetupLine));
    //Only show LocalEndpoints for the current company
    queryBuildRange = queryBuildDataSource.addRange(fieldnum(HRCCompRefPointSetupLine, RefPointSetupId));
    select HRCCompGrid where HRCCompGrid.GridId ==SalaryAmend.GridId ;
//SalaryAmend.GridId is the FormTable.Fild1
    queryBuildRange.value(HRCCompGrid.RefPointSetupId);
//this select query makes the queryBuildRange values from another table for the datasource of another table
    //Assign the query to the lookup form
    sysTableLookup.parmQuery(query);
    // Perform lookup
    sysTableLookup.performFormLookup();
    // Don't call super()
    //super()
}
4.       Third field given a lookup with filtering on based of above 2 fields.
·         As FormTable.Fild3
public void lookup()
{
    Query query = new Query();
    QueryBuildDataSource queryBuildDataSource,qbds;
    QueryBuildRange qbr1,qbr2;
    SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(HcmCompensationLevel), this);
    sysTableLookup.addLookupfield(fieldnum(HcmCompensationLevel, CompensationLevelId));
    sysTableLookup.addLookupfield(fieldnum(HRCComp, RefPointId));
    sysTableLookup.addLookupfield(fieldnum(HRCComp, GridId));
    queryBuildDataSource = query.addDataSource(tableNum(HcmCompensationLevel));
    qbds = queryBuildDataSource.addDataSource(tableNum(HRCComp));
    qbds.joinMode(JoinMode::ExistsJoin);
    qbds.relations(true);
    qbr1 = qbds.addRange(fieldNum(HRCComp,GridId));
    qbr2 = qbds.addRange(fieldNum(HRCComp,RefPointId));
    qbr1.value(SalaryAmend.GridId);
    qbr2.value(SalaryAmend.RefPointId);
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
    //super();HcmCompensationLevel

}

Tuesday, February 18, 2014

Error: No connection could be made because the target machine actively refused it 127.0.0.1:2383 for Dynamic AX 2012

Hi,

This error will arise in many different cases.
1. Some time it thrown when you open any reports in Dynamic AX 2012
2. Some time it thrown when opening only retail reports in Dynamic AX 2012
3. While connecting to the SSAS from SSMS
Solution:
Start the following services
·         Sql Server Analysis Services
·         Sql Server Agent
·         Sql Server
·         Sql Server Browser
·         Note: Please check “ Sql Server Analysis Services “  Status once you start remaining service may impact on stopping this service.

Regards,




SQL code to upate one Legal entity banner to all the legal entity in D365

 Hi, update companyimage set  companyimage.Image  = companyimageA.Image  from  ( select Image from companyimage where dataAreaid = 'USF...