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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to passing parameter automatic using UI Builder Class to Develop SSRS Report ?

(0) ShareShare
ReportReport
Posted on by 3,805
Hi all..

i have customize report with parameter Project Id and Name from modul Project management
and accounting. i use Contract class like this :

[
DataContractAttribute,
SysOperationContractProcessingAttribute(classstr(ProjTable_UI_Builder),
SysOperationDataContractProcessingMode::CreateUIBuilderForRootContractOnly)
]

public class ProjTable_contract
{
ProjId _projId;
DirPartyName _partyName;
DirPartyNumber _partyNumber;
}

[
DataMemberAttribute('ProjId')
]

public ProjId parmProjId(ProjId _projIdX = _projId)
{
_projId = _projIdX;
return _projId;
}

[
DataMemberAttribute("DirPartyName")
]

Public DirPartyName parmPersonnelName(DirPartyName _partyNameX = _partyName)
{
_partyName = _partyNameX;
return _partyName;
}

[
DataMemberAttribute("DirPartyNumber")
]

Public DirPartyNumber parmPersonnelNumber(DirPartyNumber _partyNumberX = _partyNumber)
{
_partyNumber = _partyNumberX;
return _partyNumber;
}

And then UI Builder class :
----------------------------

public class ProjTable_UI_Builder extends SrsReportDataContractUIBuilder
{
DialogField dialogPersonnelNumber, dialogPersonnelName;
}

 

public void personnelNameLookup(FormStringControl _lookup)
{
Query query = new Query();
QueryBuildDataSource qbds;
SysTableLookup sysTableLookup;

if (_lookup != null)
{
sysTableLookup = SysTableLookup::newParameters(tableNum(ProjTable_View), _lookup);
sysTableLookup.addLookupfield(fieldNum(ProjTable_View, PersonnelNumber));
sysTableLookup.addLookupfield(fieldNum(ProjTable_View, Name));
sysTableLookup.addLookupfield(fieldNum(ProjTable_View, PIL_Position));
qbds = query.addDataSource(tableNum(ProjTable_View));

sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
}

public void personnelNameModified(FormStringControl _formStringControl)
{
ProjTable_contract _ProjTable_contract;
DirPartyTable _DirPartyTable;
DirPerson _DirPerson;
HcmWorker _HcmWorker;

_formStringControl.modified();
_HcmWorker = HcmWorker::findByPersonnelNumber(dialogPersonnelNumber.value());
_DirPerson = DirPerson::find(_HcmWorker.Person);
_DirPartyTable = DirPartyTable::findRec(_DirPerson.RecId);
dialogPersonnelName.value(_DirPartyTable.Name);

if(this.dataContractObject())
{
_ProjTable_contract = this.dataContractObject() as ProjTable_contract;
_ProjTable_contract.parmPersonnelName(_DirPartyTable.Name);
}
}

public void postBuild()
{
super();

dialogPersonnelNumber = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(ProjTable_contract, parmPersonnelNumber));
dialogPersonnelNumber.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(ProjTable_UI_Builder, personnelNameLookup), this);
dialogPersonnelNumber.lookupButton(2);

dialogPersonnelName = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(ProjTable_contract, parmPersonnelName));
dialogPersonnelName.allowEdit(false);
}

public void postRun()
{
Dialog dialogLocal = this.dialog();
ProjTable_contract contract = this.dataContractObject() as ProjTable_contract;

super();

dialogLocal.dialogForm().formRun().controlMethodOverload(false);

dialogPersonnelNumber = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(ProjTable_contract, parmPersonnelNumber));
dialogPersonnelNumber.registerOverrideMethod(methodStr(FormStringControl, modified), methodStr(ProjTable_UI_Builder, personnelNameModified), this);
}



And then, i try for run my report.
in modul Project management and accounting.
example : i click one Project, YPP-PRJ/16/05/JL-FP2/AC-03.

3364.5.jpg

And then i click button Test Print.
1602.6.jpg

i want, parameter Project is disable and automatic get project based on record in form,
can not select parameter Project.
can i do it in SSRS Report?
and How ?

Thanks all.

*This post is locked for comments

I have the same question (0)
  • fajar Profile Picture
    3,805 on at

    Please help.

  • Verified answer
    Martin Dráb Profile Picture
    240,002 Most Valuable Professional on at

    Instead of begging for help, you should rather spend more time explaining your problem. People can't help you if they don't understand what you want.

    Assuming that your actual problem is in filling the project ID, you should do it in your controller class, prePromptModifyContract() method. Use your favorite search engine to find examples on internet, or look at existing controller classes in AX.

  • fajar Profile Picture
    3,805 on at

    Thanks Martin Drab.

    Yes, i use class Controller with prePrompModifyContract() method.

    protected void preRunModifyContract()

    {

       ProjTable_contract          contract;

       ProjTable                   _ProjTable;

       if (!this.parmArgs().record())

       {

           throw error("@SYS26348");

       }

       else

       {

           _ProjTable = this.parmArgs().record();

       }

       if (_ProjTable)

       {

           contract = this.parmReportContract().parmRdpContract() as ProjTable_contract;

           if (contract)

           {

               contract.parmProjId(_ProjTable.ProjId);

           }

       }

    }

    And then i create Output menuItem with properties :

    ObjectType : Class

    Object : ProjTable_Controller

    LinkedPermissionType : SSRSReport

    LinkedPermissionObject : myReport

    LinkedPermissionObjectChild : myReportDesign

    RunOn : Called From

    But, if i call my report in form, class controller not run.

    Parameter Project must select, not based on record in form.

    Please help.

    Thanks.

  • Martin Dráb Profile Picture
    240,002 Most Valuable Professional on at

    I'm sorry, but you'll have to elaborate what you mean by "class controller not run".

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans