Line Reference

Hi !

my requirement is to design a document page and call that page in sales line reference. When i entered the data in the sales order page then that data should moves into created page. I had tried this but i am getting only header information not the line data and here as follows that i had done. I called that page in sales line under Function Action and took a local function in Sales Order subform and written the code as

X.RESET;
X.INIT;
X.No := SalesHeader."No.";
X.INSERT(TRUE);

Y.RESET;
Y.INIT;
Y."No" := X.No;
Y."Line No" := SalesLine."Line No.";
Y.INSERT(TRUE);

Where X is created header and Y is created Line and i had X primary key as No and Y primary keys as No and Line No.
Thanks In Advance.

Answers

  • ErictPErictP Member Posts: 164
    The line Y."No" := X.No; is wrong.

    Must be Y."Document No." := X.No;
  • Thanks for the reply ErictP :smile:

    Yes i had taken that, but it shows the same output line information is passing in to my Line table only Document No field is filled and Line No field is not filled and also multiple lines are not allowing to take in Sales order and multiple lines are not passing in created line table.
  • ErictPErictP Member Posts: 164
    Take a look at the function 'ShowItemChargeAssgnt' in the table 'Sales Line'.
    I think that this is the same procedure as what you want to accomplish.
  • Thanks !
    but the code i need to follow as

    Y.RESET;
    Y.SETRANGE("Document No.","Document No.");
    Y.SETRANGE("Document Line No.","Line No.");
    IF NOT Y.FINDLAST THEN BEGIN
    Y."Document No." := "Document No.";
    Y."Line No." := "Line No.";
    END; is it correct or else need to change the code.
    Ok thanks for the suggestion let me try this.
  • When i followed the concept which you (ErictP) suggest there data is not inserted it generate the error message as follows:

    p3hhdmb33dpa.png
  • Yeah Cleared this error also getting only header data and in line data only getting Document No and line No is missing and also multiple lines are not generated.
  • ErictPErictP Member Posts: 164
    Please insert full code so we can see what you are trying to accomplish.
  • LOCAL GetPlayListheader()
    PlayListHeader.RESET;
    PlayListHeader.SETRANGE(No,SalesHeader."No.");
    PlayListHeader.INIT;
    PlayListHeader.No := SalesHeader."No.";
    PlayListHeader.INSERT;

    ShowPlaylistInfo()
    //GET("Document Type","Document No.","Line No.");

    GetPlayListheader;

    PlayListLine.RESET;
    PlayListLine.SETRANGE("Playist No","Document No.");
    PlayListLine.SETRANGE("Line No","Line No.");
    PlayListLine.INIT;
    PlayListLine."Playist No" := "Document No.";
    PlayListLine."Line No" := "Line No.";
    PlayListLine.INSERT;

    This two are function which was taken in Sales Line table and taken a function in the sales subform as :
    Playlist()
    ShowPlaylistInfo;
    and in the Action called this Playlist.
    I think i am missing loop concept which useful to insert multiple line .
    Can you please suggest me if i missed this.
  • ErictPErictP Member Posts: 164
    Is there a 1 to 1 connection between the SalesLine and the PlayListLine?
  • No

    Is it necessary as i am new to this.
  • Here is the output which i got when entered data in sales line.
    5y0svmhyghgb.png

  • ErictPErictP Member Posts: 164
    So your datamodel looks like this:
    SalesHeader
    	 |
    	 |-Sales Line 1
    	 | 	|- PlayListLine 1
    	 |	|- PlayListLine 2
    	 |
    	 |-Sales Line 2
    		|- PlayListLine 3
    		|- PlayListLine 4
    

  • s3p5iszhg88i.png

    When sales order filled with data then automatically Reference document page should be filled with sales order data.This is my requirement.
  • But keys are different playlist line had only Document No and Line No as keys.
  • ErictPErictP Member Posts: 164
    If I understand you correctly:
    The primary key of the table 'Playlist Header' is the same as the 'Sales Header'. ( "No.")
    The primary key of the table 'PlayList line' is the same as the 'Sales Line'. ("Document No.", "Line No.")
  • Yes

    but why the data didn't flow from sales line and also not accepting multiple lines of data.
    Did i miss anything or anything wrong in my code.
    Suggest me if i miss anything.
    Thanks in Advance...
  • ErictPErictP Member Posts: 164
    I think that your table 'PlayList line' is missing a field 'Document Line No.'
    The primary key should for example be: Document No. , Document Line No., Line No.

    Try to look again to the function ShowItemChargeAssgnt.
    Especially to the part:
    ItemChargeAssgntSales.RESET;
    ItemChargeAssgntSales.SETRANGE("Document Type","Document Type");
    ItemChargeAssgntSales.SETRANGE("Document No.","Document No.");
    ItemChargeAssgntSales.SETRANGE("Document Line No.","Line No.");
    ItemChargeAssgntSales.SETRANGE("Item Charge No.","No.");
    IF NOT ItemChargeAssgntSales.FINDLAST THEN BEGIN
      ItemChargeAssgntSales."Document Type" := "Document Type";
      ItemChargeAssgntSales."Document No." := "Document No.";
      ItemChargeAssgntSales."Document Line No." := "Line No.";
      ItemChargeAssgntSales."Item Charge No." := "No.";
      ItemChargeAssgntSales."Unit Cost" :=
        ROUND(ItemChargeAssgntLineAmt / Quantity,
          Currency."Unit-Amount Rounding Precision");
    END;
    

    In this part are the value's of the salesline copied to the ItemChargeAssgntSales. (In your case to the PlayList Line)
  • Yes the same code as per my requirement.

    PlayListLine.RESET;
    PlayListLine.SETRANGE("Playist No","Document No.");
    PlayListLine.SETRANGE("Line No","Line No.");
    IF NOT PlayListLine.FINDLAST THEN BEGIN
    PlayListLine."Playist No" := "Document No.";
    PlayListLine."Line No" := "Line No.";
    End;

    Where Document Line is a field in ItemChargeAssgntSales but in my case Line No
  • ErictPErictP Member Posts: 164
    If you want multiple PlayListLine's per SalesLine and PlayListLine."Line No" is the last field in your primary key then this is wrong: PlayListLine."Line No" := "Line No.";

    Add field PlayListLine."Document Line No."
    Change primary key to "Playist No", "Document Line No.", "Line No"
    Change code to PlayListLine."Document Line No" := "Line No.";
  • Ok let me try it..
  • No Result same output.
    I think use the Repeat until concept to flow all the fields from sales line to PlayList Line.
Sign In or Register to comment.