Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

Dynamics AX 2012 R2 report lookup is empty

Posted on by Microsoft Employee

Hi experts,

i am getting my RDP report filter Lookup empty although table has data.Below is my code written.

/*Contract Class*/

[DataContractAttribute
,SysOperationContractProcessingAttribute(Classstr(PRSalarySheetUIBuilder))]
class PRSalarySheetContract
{
    List  prDimension;
    List  prPayGroupCode;
    List  prPayPeriodCode;
}

public void new()
{
    prDimension = new List(Types::String);
    prPayGroupCode =  new List(Types::String);
    prPayPeriodCode = new List(Types::String);

}

[
DataMemberAttribute(identifierStr(PRDimension)),
SysOperationLabelAttribute(literalstr("Dimension Department")),
SysOperationDisplayOrderAttribute("1"),
AifCollectionTypeAttribute(extendedTypeStr(PRDimension), Types::String)
]
public List parmPRDimension(List _prDimension= prDimension)
{
    prDimension = _prDimension;
    return prDimension;
}

[
DataMemberAttribute('Pay GroupCode'),
SysOperationLabelAttribute(literalstr("Pay GroupCode")),
SysOperationDisplayOrderAttribute("2"),
AifCollectionTypeAttribute(extendedTypeStr(PRPayGroupCode), Types::String)
]
public List parmPRPayGroupCode(List _prPayGroupCode = prPayGroupCode)
{
    prPayGroupCode = _prPayGroupCode;
    return prPayGroupCode;
}

[
DataMemberAttribute('Pay PeriodCode'),
SysOperationLabelAttribute(literalstr("Pay PeriodCode")),
SysOperationDisplayOrderAttribute("3"),
AifCollectionTypeAttribute(extendedTypeStr(PRPayPeriodCode), Types::String)
]
public List parmPRPayPeriodCode(List _prPayPeriodCode = prPayPeriodCode)
{
    prPayPeriodCode = _prPayPeriodCode;
    return prPayPeriodCode;
}

    
/*Contract Class*/

/* UI Builder Class*/

class PRSalarySheetUIBuilder extends SrsReportDataContractUIBuilder
{
    DialogField  dialogOffDimension,dialogPayPeriodCode,dialogPayGroupCode;
    SysLookupMultiSelectGrid msCtrloffDimension,msCtrlPayPeriodCode,msCtrlPayGroupCode;
    PRSalarySheetContract contract;

}
public void build()
{
    contract = this.dataContractObject();

    dialogOffDimension = this.addDialogField(methodStr(PRSalarySheetContract,parmPRDimension), contract);
    dialogPayGroupCode = this.addDialogField(methodStr(PRSalarySheetContract,parmPRPayGroupCode), contract);
    dialogPayPeriodCode = this.addDialogField(methodStr(PRSalarySheetContract,parmPRPayPeriodCode), contract);
}
public void OffsetDimLensionLookUp(FormStringControl _control)
{
    msCtrloffDimension = SysLookupMultiSelectGrid::construct(_control, _control);
    msCtrloffDimension.parmQuery(this.OffsetDimensionQuery());
    msCtrloffDimension.run();
}
private Query OffsetDimensionQuery()
{

    Query query = new Query();
    QueryBuildDataSource queryBuildDataSource,qbds;

    queryBuildDataSource = query.addDataSource(tableNum(PREmployeePayments));


    queryBuildDataSource.fields().dynamic(false);
    queryBuildDataSource.fields().clearFieldList();

    queryBuildDataSource.addSelectionField(fieldNum(PREmployeePayments, OffsetDimension));

    return query;

}
public void PayGroupCodeLookUp(FormStringControl _control)
{
    msCtrlPayGroupCode = SysLookupMultiSelectGrid::construct(_control, _control);
    msCtrlPayGroupCode.parmQuery(this.PayGroupCodeQuery());
    msCtrlPayGroupCode.run();
}

private Query PayGroupCodeQuery()
{

    Query query = new Query();
    QueryBuildDataSource queryBuildDataSource,qbds;

    queryBuildDataSource = query.addDataSource(tableNum(PRPayGroupPayPeriod));

    queryBuildDataSource.fields().dynamic(false);
    queryBuildDataSource.fields().clearFieldList();

    queryBuildDataSource.addSelectionField(fieldNum(PRPayGroupPayPeriod, PayGroupCode));

    return query;
}
public void PayPeriodCodeLookUp(FormStringControl _control)
{
    msCtrlPayPeriodCode = SysLookupMultiSelectGrid::construct(_control, _control);
    msCtrlPayPeriodCode.parmQuery(this.PayPeriodCodeQuery());
    msCtrlPayPeriodCode.run();
}
private Query PayPeriodCodeQuery()
{

    Query query = new Query();
    QueryBuildDataSource queryBuildDataSource,qbds;

    queryBuildDataSource = query.addDataSource(tableNum(PRPayGroupPayPeriod));

    queryBuildDataSource.fields().dynamic(false);
    queryBuildDataSource.fields().clearFieldList();

    queryBuildDataSource.addSelectionField(fieldNum(PRPayGroupPayPeriod, PayPeriodCode));
    
    return query;
}

public void postbuild()
{
    super();

    dialogOffDimension = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(PRSalarySheetContract,parmPRDimension));
    dialogOffDimension.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(PRSalarySheetUIBuilder,OffsetDimLensionLookUp), this);
    if (dialogOffDimension)
    {
        dialogOffDimension.lookupButton(2);
    }


    dialogPayPeriodCode = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(PRSalarySheetContract,parmPRPayGroupCode));
    dialogPayPeriodCode.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(PRSalarySheetUIBuilder,PayGroupCodeLookUp), this);
    if (dialogPayPeriodCode)
    {
        dialogPayPeriodCode.lookupButton(2);
    }

    dialogPayGroupCode = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(PRSalarySheetContract,parmPRPayPeriodCode));
    dialogPayGroupCode.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(PRSalarySheetUIBuilder,PayPeriodCodeLookUp), this);
    if (dialogPayGroupCode)
    {
        dialogPayGroupCode.lookupButton(2);
    }


}
public void postRun()
{
    //super();
    //this.dialog().dialogForm().formRun().controlMethodOverload(false);
} 

/* UI Builder Class*/


/* RDP Class*/

[SRSReportParameterAttribute(classStr(PRSalarySheetContract))]
public class PRSalarySheetDP extends SRSReportDataProviderBase
{
    PRSalarySheetTemp   pRSalarySheetTemp;
    PREmployeePayments  pREmployeePayments;
    PRPayGroupPayPeriod pRPayGroupPayPeriod;
}

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

    PRSalarySheetContract           contract;
   
    contract        =   this.parmDataContract() as PRSalarySheetContract;

    offDimensionList = contract.parmPRDimension();
    PayPeriodList = contract.parmPRPayPeriodCode();
    PayGroupList = contract.parmPRPayGroupCode();
    
    //
    Logic....
    //


}

All Parameters Lookup show empty.

pastedimage1585314345969v1.png

Help me to sort out the issue.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics AX 2012 R2 report lookup is empty

    Hi Sergei,

    Thanks my problem got solved by writing code in post run method and following dimension lookup blog you mentioned above.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics AX 2012 R2 report lookup is empty

    Hi Sergei,

    Table has current company data in it.but debugger is not working in lookup methods,may be due to old version of AX 2012 R2 CU1.

  • Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: Dynamics AX 2012 R2 report lookup is empty

    Hi Faran,

    Try to check if your lookup methods are catched in the debugger. If yes, check if you have data in these tables in your company as well.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics AX 2012 R2 report lookup is empty

    Hi Sergei,

    Checked the blog and tried with postRun method, but still lockups are showing empty.

  • Verified answer
    Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: Dynamics AX 2012 R2 report lookup is empty

    Hi Faran,

    Why did you comment out postRun method?

    Check this tutorial microsoft-dynamics-ax-erp.blogspot.com/.../dialog-fields-and-runtime-lookups-on.html

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics AX 2012 R2 report lookup is empty

    Hi Sergei,

    But don't know why still data is not showing.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics AX 2012 R2 report lookup is empty

    Hi Sergei,

    Actually i attached old code,this mistake i covered earlier,but that does not too populated data.Please review my updated attached code again.

  • Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: Dynamics AX 2012 R2 report lookup is empty

    Hi Faran,

    Why are you using PREmployeePayments as a source for lookup? Can't you use the main tables instead for Group and Perdio code?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics AX 2012 R2 report lookup is empty

    Hi Sergei,

    Rest of two lookup are also showing empty.What about that?

    pastedimage1585322869630v1.png

  • Verified answer
    Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: Dynamics AX 2012 R2 report lookup is empty

    Hi Faran,

    Looks like you want to make a lookup for department financial dimension.

    Check this article on how to make this kind of lookup. Please note, that it's not recommended to use constants in code (like static value for dimension attribute name) and it's better to parameterize these.

    thinkinginax.blogspot.com/.../financial-dimension-lookup.html

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans