As to pass parameters among objects

albertodfaalbertodfa Member Posts: 15
:evil:
how do I do to pass a datum (type number document) from a form to a dataport launched through OnPush? I have written this code:
FORM 51
Menu Items = Importa Telefonia Fissa

Globals = Name DataType Subtype Length
RUNDATAPORT Dataport Importa Telefonia Fissa

<Control- OnPush() = RUNDATAPORT.PassaTestataAcquisti(Rec);
__________________________________________________________

Dataport 50029
Functions = PassaTestataAcquisti
Locals = Var Name DataType Subtype Length
No RecTestataAcquisti Record Testate Acquisti

Codice C/AL
Trigger
PassaTestataAcquisti(RecTestataAcquisti : Record "Testate Acquisti")
TestateAcquisti.SETRANGE("Nr.",RecTestataAcquisti."Nr.");
___________________________________________________________
Quest.
Because after having performed the code of the function in the Dataport he/she returns me to the Form that has called the Dataport?
Is the code correct?

Thanks

Comments

  • krikikriki Member, Moderator Posts: 9,118
    If I understood correctly, you want to pass the current Purchase Header-record to the dataport that has to export it?

    In the calling form, you put:
    CLEAR(dtpMyDataport);
    dtpMyDataport.InputParameters(rec);
    dtpMyDataport.RUNMODAL;
    

    in the dataport:
    GLOBAL VARIABLE:recPurchaseHeader : record Purchase Header
    Function InputParameters(IrecPurchaseHeader : record Purchase Header
    recPurchaseHeader := IrecPurchaseHeader;
    

    in "Purchase Header - OnPreDataItem()"
    RESET;
    SETRANGE("Document Type",recPurchaseHeader."Document Type");
    SETRANGE("No.",recPurchaseHeader."No.");
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • RoelofRoelof Member Posts: 377
    That does NOT work for a dataport or report because a dataport and report are initializing the entire object. You can only use it this way in the request form.
    Roelof de Jonghttp://www.wye.com
  • krikikriki Member, Moderator Posts: 9,118
    Roelof wrote:
    That does NOT work for a dataport or report because a dataport and report are initializing the entire object. You can only use it this way in the request form.
    If you are refering to my code. It DOES work. Also for reports and dataports.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Yes It does work! I always has been this way. :D

    Maybe it is unfair to link to this post but I will do so anyway :|
    http://www.mibuso.com/forum/viewtopic.p ... highlight=
  • krikikriki Member, Moderator Posts: 9,118
    Yes It does work! I always has been this way. :D

    Maybe it is unfair to link to this post but I will do so anyway :|
    http://www.mibuso.com/forum/viewtopic.p ... highlight=
    Why unfair. That post is fun! :lol:
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
  • krikikriki Member, Moderator Posts: 9,118
    :mrgreen:
    I see you have nothing to do again O:)
    Or escaping from your little baby (like me) :mrgreen:
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.