Select Specific Row in Subform via OnLookup

headley27headley27 Member Posts: 188
I am navigating from a custom form to the Released Production Order Form (99000831).

The table that drives the custom form includes the following fields:
    Prod. Order No.
    Prod. Order Line No.
What I would like to do is open the Released Production Order Form (99000831) which contains the Released Production Order Lines Subform (99000832) and automatically select the subform row specified by the Prod. Order Line No. field.

For example:
    ProdOrder.RESET;
    ProdOrder.SETRANGE(ProdOrder."No.", "Prod. Order No.");
    IF ProdOrder.FIND('-') THEN BEGIN 
      FORM.RUN(99000831, ProdOrder);
      >>>Some Code Here (Perhaps) To Jump To Subform Record (Prod. Order Line No.)<<<
    END;

Is this possible?

Thank you,
headley27

Answers

  • NaviDevNaviDev Member Posts: 365
    Declare the prod order form as variable. Instead of using filtering such as (SETRANGE and SETFILTER) use GET function, then pass the table to the FormVariable.SETTABLEVIEW.
    Navision noob....
  • garakgarak Member Posts: 3,263
    You will open the Form 99000831 and on this place the arrow on the selected line which is stored in your looked up field :?:

    If yes, make a new function on Main form to pass the prod. order line and on Subform to get the order line.
    declare the mainform (831) as variable. Call the new function on mainform and pass the prod order line. Then run the form. In OnAfterGet you call the new fundtion in subform the set the line. In the function in subform you set the filter to the line.

    Also note, the user should not scroll through the Headers.

    Regards
    Do you make it right, it works too!
  • krikikriki Member, Moderator Posts: 9,115
    Wouldn't it be easier to show the lines in the tablebox?
    You might add some extra fields from the header on it.
    This is the way standard Navision does it (e.g. function Get shipment lines in the sales invoice).
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • headley27headley27 Member Posts: 188
    Thank you everyone.

    Garak put me down the right path. After I read his comments I remembered the PassParameters Codeunit that is referenced on Mibuso (as a download if I recall correctly).

    After I passed the parameter between forms i used the following code which works perfectly.
    Form - OnAfterGetCurrRecord()
    IF ProdOrderLineNo <> 0 THEN 
      GET(Status::Released, "Prod. Order No.", ProdOrderLineNo)
    ELSE
      ProdOrderLineNo := 0;
    

    :D Thanks again!!
  • headley27headley27 Member Posts: 188
    headley27 wrote:
    After I read his comments I remembered the PassParameters Codeunit that is referenced on Mibuso (as a download if I recall correctly).
    Nope...not a download. It's a 'How-To'

    http://www.mibuso.com/howtoinfo.asp?FileID=7
Sign In or Register to comment.