web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

'List object not initialized' in RDP class

(0) ShareShare
ReportReport
Posted on by 1,214

Hi. I'm creating a UIBuilder to filter report parameters with multiple lookup field. I got this error when generating the report. The exception is caught on DP.processReport() method as commented below in the code. Here's the code:

Controller Class

public class ProductionOutputDailyController extends SrsReportRunController
{
}

protected void preRunModifyContract()
{
ProductionOutputDailyContract contract;
}

 

public static void main(Args _args)
{
ProductionOutputDailyController controller = new ProductionOutputDailyController();

controller.parmReportName(ssrsReportStr(ProductionOutputDaily, PrecisionDesign1));
controller.parmArgs(_args);
controller.startOperation();
}

UIBuilder Class

 

public class ProductionOutputDailyUIBuilder extends SysOperationAutomaticUIBuilder
{
DialogField dfItemGroupId;

SysLookupMultiSelectGrid msCtrlInventItemGroup;
}

public void build()
{
ProductionOutputDailyContract contract;

contract = this.dataContractObject() as ProductionOutputDailyContract;
dfItemGroupId = this.addDialogField(methodStr(ProductionOutputDailyContract, parmItemGroupId),contract);
}

public void postBuild()
{
ProductionOutputDailyContract contract;

super();

contract = this.dataContractObject() as ProductionOutputDailyContract;

dfItemGroupId = this.bindInfo().getDialogField(contract, methodStr(ProductionOutputDailyContract, parmItemGroupId));
dfItemGroupId.registerOverrideMethod(methodStr(FormStringControl, lookup), methodStr(ProductionOutputDailyUIBuilder, itemGroupIdLookup), this);
if (dfItemGroupId)
{
dfItemGroupId.lookupButton(2);
}

}

private void itemGroupIdLookup(FormStringControl _control)

{

   Query       query;

   container   conInventItemGroup;

   query = new Query(queryStr(InventItemGroup));

   msCtrlInventItemGroup = SysLookupMultiSelectGrid::construct(_control, _control);

   msCtrlInventItemGroup.parmQuery(query);

   msCtrlInventItemGroup.run();

}

Data Provider Class

 

[
SRSReportParameterAttribute(classStr(ProductionOutputDailyContract))
]
public class ProductionOutputDailyDP extends SRSReportDataProviderBase
{
TmpProductionOutputDaily tmpProductionOutputDaily, tmpProductionOutputDailyGet1, tmpProductionOutputDailyGet2;
TmpProductionOutputDailyFilter tmpProductionOutputDailyFilter;

List itemGroupIdList;
}

[
SRSReportDataSetAttribute(tableStr(TmpProductionOutputDailyFilter))
]
public TmpProductionOutputDailyFilter getTmpProductionOutputDailyFilter()
{
return tmpProductionOutputDailyFilter;
}

 

[SysEntryPointAttribute(false)]
public void processReport()
{

ProductionOutputDailyContract contract;

TransDate fromDate, toDate;
String255 itemId, warehouse, journalName, itemGroupId, productType;
ItemNetWeight itemNetWeight;

contract = new ProductionOutputDailyContract();
contract = this.parmDataContract() as ProductionOutputDailyContract;

itemGroupIdList = contract.parmItemGroupId();

itemGroupId = strRem(strRem(itemGroupIdList.toString(),"<"),">");    //ERROR MESSAGE HERE

//rest of code......

tmpProductionOutputDailyFilter.insert();

}

 

Contract Class

 

[
DataContractAttribute,
SysOperationContractProcessingAttribute(classstr(ProductionOutputDailyUIBuilder))
]
public class ProductionOutputDailyContract
{
MonthsOfYear reportMonth;
int yearFilter;
String255 itemGroupId;
List itemGroupIdList;
}

[
DataMemberAttribute('ItemGroupId'),
AifCollectionTypeAttribute("itemGroupIdList", Types::String),
SysOperationLabelAttribute(literalstr("Item Group")),
SysOperationHelpTextAttribute(literalstr("Item Group")),
SysOperationDisplayOrderAttribute('7')
]
public List parmItemGroupId(List _itemGroupIdList = itemGroupIdList)
{
itemGroupIdList = _itemGroupIdList;
return itemGroupIdList;
}


I have refresh all cache, refresh usage data, restart server, still no luck. Feel free to ask if you need more information on the error. Thank You. 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Rohin Profile Picture
    4,624 on at

    Error message shows clearly that you have not initialized the List . try this one :

    List   itemGroupList;
    
    ;
    itemGroupList = new List(Types::string);
    
    


  • HAIRUL HAZRI Profile Picture
    1,214 on at

    Hi Visvash, I tried like this but still not fixed:

    ProductionOutputDailyContract contract;

    List   itemGroupIdList ;

    ;

    contract = new ProductionOutputDailyContract();

    contract = this.parmDataContract() as ProductionOutputDailyContract;

    itemGroupIdList = new List(Types::string);

    itemGroupIdList = contract.parmItemGroupId();

    itemGroupId = strRem(strRem(itemGroupIdList.toString(),"<"),">");

    Thank You.

  • BrandonSA Profile Picture
    1,673 on at

    Hi HAIRUL

    I think i'm missing something somewhere...What exactly is the error message? I can't seem to find it

    Thanks

  • BrandonSA Profile Picture
    1,673 on at

    Sorry... I see the message now, in the subject :)

    Your contract class isn't returning anything. You did implement a itemGroupIdLookup method on your UIBuilder right?

  • HAIRUL HAZRI Profile Picture
    1,214 on at

    Hi Brandon, here's the message screenshot:

    dperror.png

    line 52 of DP/processReport is on  

    itemGroupId = strRem(strRem(itemGroupIdList.toString(),"<"),">");

    as I commented in the code above.

    Thank You.

  • HAIRUL HAZRI Profile Picture
    1,214 on at

    Yes itemGroupIdLookup is on UIBuilder. Here's the method. InventItemGroup query contains ItemGroupID & Name field on InventItemGroup Table:

    private void itemGroupIdLookup(FormStringControl _control)

    {

       Query       query;

       container   conInventItemGroup;

       query = new Query(queryStr(InventItemGroup));

       msCtrlInventItemGroup = SysLookupMultiSelectGrid::construct(_control, _control);

       msCtrlInventItemGroup.parmQuery(query);

       msCtrlInventItemGroup.run();

    }

  • Martin Dráb Profile Picture
    237,972 Most Valuable Professional on at

    Use the debugger to understand what's happening in your code. First of all, make sure that itemGroupIdList variable has a value before you try to work with it.

  • Suggested answer
    BrandonSA Profile Picture
    1,673 on at

    Wow... don't know how i missed it! :)

    Your contract is obviously returning an empty list.

    I noticed you're doing nothing with the container object in your lookup.

    What if you implement your lookup like:

       Query       query;

       container   conInventItemGroup;

       SysLookupMultiSelectGrid::lookup(

    new Query(queryStr(InventItemGroup)),

    _control,

    _control,

    conInventItemGroup);

  • HAIRUL HAZRI Profile Picture
    1,214 on at

    Hi Brandon. I tried it like this but still not fixed:

    private void itemGroupIdLookup(FormStringControl _control)
    {
    Query query;
    container conInventItemGroup;


    SysLookupMultiSelectGrid::lookup(new Query(queryStr(InventItemGroup)),_control,_control,conInventItemGroup);
    msCtrlInventItemGroup = SysLookupMultiSelectGrid::construct(_control, _control);
    msCtrlInventItemGroup.parmQuery(query);
    msCtrlInventItemGroup.run();

    }

  • HAIRUL HAZRI Profile Picture
    1,214 on at

    Hi Martin, in DP, I already handled the case if itemGroupId is not selected for filter like this:

    if (itemGroupId)

       {

           qbrBOM = queryBOM.dataSourceTable(tablenum(InventItemGroupItem)).findRange(fieldNum(InventItemGroupItem, itemGroupId));

           qbrBOM.value(itemGroupId);

       }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans