Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 175888

Pass parameter from form to report

$
0
0

Hello everyone,

I have created a SSRS report that uses Contract,Contoller and DP classes and I want to pass a paremeter that I'm creating on the button click, to the report.

I have create a parameter in the contract class

class TCI_OutsideServicePackingSlipContract
{
    TCI_OutsideServicePackingSlipId     packingSlipId;

    [
    DataMemberAttribute('TCI_OutsideServicePackingSlipId'),
    SysOperationLabelAttribute(literalStr('PackingSlipId')),
    SysOperationControlVisibilityAttribute(false)
    ]
    public TCI_OutsideServicePackingSlipId parmPackingSlipId(TCI_OutsideServicePackingSlipId _packingSlipId = packingSlipId)
    {
        packingSlipId = _packingSlipId;
        return packingSlipId;
    }

}

I have tried to pass the field into the parameter during the button click

 public void clicked()
        {
            TCI_OutsideServiceImportLog             outsideServiceImport;
            MultiSelectionHelper                    helper = MultiSelectionHelper::construct();
            TCI_OutsideServicePackingSlipHeader     packingSlipHeader;
            TCI_OutsideServicePackingSlipDetails    packingSlipDetails;
            int                                     sequence = 0;
            TCI_OutsideServicePackingSlipContract   contract = new TCI_OutsideServicePackingSlipContract();

            helper.parmDatasource(TCI_OutsideServiceImportLog_DS);

            outsideServiceImport  = helper.getFirst();

            packingSlipHeader.TCI_OutsideServicePackingSlipId   = NumberSeq::newGetNum(ProdParameters::numRefTCI_OutsideServicePackingSlipEDT(),true).num();
            packingSlipHeader.PurchId                           = outsideServiceImport.ResultNumber;
            packingSlipHeader.VendAccount                       = outsideServiceImport.VendAccount;
            packingSlipHeader.insert();

            contract.parmPackingSlipId(packingSlipHeader.TCI_OutsideServicePackingSlipId);

            while(outsideServiceImport.RecId != 0)
            {
                packingSlipDetails.TCI_OutsideServicePackingSlipId  = packingSlipHeader.TCI_OutsideServicePackingSlipId;
                packingSlipDetails.Seq                              = sequence;
                sequence = sequence + 1;
                packingSlipDetails.ItemId                           = outsideServiceImport.ItemId;
                packingSlipDetails.QtyOrdered                       = outsideServiceImport.Qty;
                packingSlipDetails.insert();
                outsideServiceImport = helper.getNext();
            }

            super();
        }

But when I get to my controller class, that parameter is empty......

class TCI_OutsideServicePackingSlipController extends SrsReportRunController
{
    public static void main(Args _args)
    {
        SrsReportRunController controller = new TCI_OutsideServicePackingSlipController();
        controller.parmReportName(ssrsReportStr(TCI_OutsideServicePackingSlip, Report));
        controller.parmArgs(_args);
        controller.startOperation();
    }

    protected void prePromptModifyContract()
    {
        TCI_OutsideServicePackingSlipContract   contract = this.parmReportContract().parmRdpContract();
        TCI_OutsideServicePackingSlipId         packingSlipId;
        
        packingSlipId = contract.parmPackingSlipId();        

        this.parmReportContract().parmReportName(ssrsReportStr(TCI_OutsideServicePackingSlip, Report));
        boolean isPreview = false;

        //Set the target print destination to screen
        if (isPreview)
        {
            this.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::Screen);
        }

        this.parmshowDialog(!isPreview);
        this.parmLoadFromSysLastValue(!isPreview);
    }

}

Normally, I wouldn't put that line packingSlipId = contract...... but I wanted to put a break point there to see if it gets anything, which is doesn't.

What am I missing?  I thought I would be able to just pass it in the contract and then grab it again if needed.....


Viewing all articles
Browse latest Browse all 175888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>