Showing posts with label LOOKUP. Show all posts
Showing posts with label LOOKUP. Show all posts

Saturday, April 16, 2016

DYNAMICS AX LOOKUP FIELD RANGE X++ CODE Fld2_1

LOOKUP FIELD RANGES IN MICROSOFT DYNAMICS AX 2012:

Override the control for eg. “Fld2_1”  in a dialog box.
public void Fld2_1_Lookup()
{
    SysTableLookup          sysTableLookup;
    QueryBuildDataSource    queryBuildDataSource;
    QueryBuildRange         queryBuildRange;
    Query                   query;
    FormStringControl       _control;
    ;

    sysTableLookup = SysTableLookup::newParameters(tablenum(CustTable),dialogCustAccount.control());

    sysTableLookup.addLookupfield(fieldnum(CustTable, AccountNum));
    sysTableLookup.addLookupfield(fieldnum(CustTable, CustGroup));

    query = new Query();

    queryBuildDataSource = query.addDataSource(tablenum(CustTable));
    queryBuildRange = queryBuildDataSource.addRange(fieldnum(CustTable, custGroup));
    queryBuildRange.value(dialogCustGroupId.value());

    sysTableLookup.parmQuery(query);

    sysTableLookup.performFormLookup();
}

Now override the “dialogPostRun()” method from the override methods and the code after super() call as shown below.
public void dialogPostRun(DialogRunbase dialog)
{
    super(dialog);
    dialog.formRun().controlMethodOverload(true);
    dialog.formRun().controlMethodOverloadObject(this);
}

This will make the second lookup filter by the customer number.

Friday, April 15, 2016

HOW TO DEBUG AX 2012 SSRS REPORT CODE BREAKPOINT SrsReportDataProviderPreProcess

HOW TO DEBUG AX 2012 SSRS REPORT 


1)   Open the DP class of the report.
2)  Extend SrsReportDataProviderPreProcess instead of SrsReportDataProviderBase
 in class declaration.
 Temp table properties should be

     (a) Table type : Regular instead of tempDB

     (b)  Created by : Yes

     (c) Created Transaction Id : Yes

Make sure  two checkboxes of user breakpoints and global breakpoints for debugging is enabled  in configuration .


AX FORM TABLE LOOKUP X++ CODE TABLE LOOKUP FORM LOOKUP

AX FORM TABLE LOOKUP X++ CODE TABLE LOOKUP FORM LOOKUP 


public void lookup()
{
 //   SysTableLookup sysTableLookup; // systemclass to create //customlookup
    Query query;
    QueryBuildDataSource qbd;
    SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(VIKASTable), this);
    ;
   // sysTableLookup = SysTableLookup::newParameters(tablenum(VIKASconfLocationTable));//_formcontrol);

    // Construct query on the table,
    // whose records you want to show as lookup.
    query = new Query();
    qbd = query.addDataSource(tablenum(VIKASTable));


    // add the fields to the lookup list
    sysTableLookup.addLookupfield(fieldnum(VIKASconfLocationTable,LocationID));
    sysTableLookup.addLookupfield(fieldnum(VIKASconfLocationTable,LocationName));

    // pass the query as parameter
    // system will show the records in the lookup
    // as per your query
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}


Form main datasource ka lookup
public void lookup(FormControl _formControl, str _filterStr)
{


   SysTableLookup sysTableLookup; // systemclass to create //customlookup
    Query query;
    QueryBuildDataSource qbd;
   // SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(VIKASTable), this);
    ;
    sysTableLookup = SysTableLookup::newParameters(tablenum(VIKASTable),_formcontrol);

    // Construct query on the table,
    // whose records you want to show as lookup.
    query = new Query();
    qbd = query.addDataSource(tablenum(Table)); 
    // add the fields to the lookup list
    sysTableLookup.addLookupfield(fieldnum(VIKASTable,Location));
   // sysTableLookup.addLookupfield(fieldnum(VIKASTable,LocationName));

    // pass the query as parameter
    // system will show the records in the lookup
    // as per your query
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}

add table lookup in form
public void lookup(FormControl _formControl, str _filterStr)
{
    SysTableLookup              sysTableLookup;
    Query                              query;
    QueryBuildDataSource    queryBuildDataSource;
    QueryBuildRange             queryBuildRange;
    ;
    sysTableLookup  = SysTableLookup::newParameters(tablenum(EmplTable), _formControl);
    sysTableLookup.addLookupfield(fieldnum(EmplTable, EmplId));
    sysTableLookup.addLookupfield(fieldnum(EmplTable, legacyEmplId));
    sysTableLookup.addLookupMethod(identifierstr(name));
    query                              =  new Query();
    queryBuildDataSource    =  query.addDataSource(tablenum(EmplTable));
 
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}

Related Posts Plugin for WordPress, Blogger...