How to insert the header No. in the subform

poppinspoppins Member Posts: 647
edited 2013-07-05 in NAV Three Tier
Hi everyone,

I am trying to create a new page with a header and a subform.

In the source table of the subform I created a field named "Group No." and I set the TableRelation to "myTable"."No."

In the header page I set the SubPageLink to "Group No."=FIELD("No.").

When I insert a line in the subform, I look at the table and find the field "Group No."(which is supposed to contain the header No.)
empty....

What shall I do to populate this field?
I looked into tables 36 and 37 with pages 42 and 46 but couldn't figure it out...

Can anyone help me on how to proceed???

Thanks in advance :)

Comments

  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    It's done via the primairy key fields. The primairy key of the records in the subpage must be the pk of the main page + a line number.
  • poppinspoppins Member Posts: 647
    It's done via the primairy key fields. The primairy key of the records in the subpage must be the pk of the main page + a line number.

    Infact, I added the field to the key and now the header no. is being inserted in the subform but when I insert many lines in the subform, only the last one is being stored in the table...

    Why is that?
  • vijay_gvijay_g Member Posts: 884
    Did you set the AutoSplitKey property of Subform True?
  • poppinspoppins Member Posts: 647
    vijay_g wrote:
    Did you set the AutoSplitKey property of Subform True?
    I did it and got the following error message:
    The Code type of key field cannot be automatically split
    
  • SavatageSavatage Member Posts: 7,142
    Look again at the sales header & sales line tables.

    see the key for the sales line is Document Type,Document No.,Line No.

    Do you have a line no field? how are you having it increment?
  • vijay_gvijay_g Member Posts: 884
    What is the Data Type of your last field in the key?

    It should be integer as in sales line table.
  • poppinspoppins Member Posts: 647
    Savatage wrote:
    Look again at the sales header & sales line tables.

    see the key for the sales line is Document Type,Document No.,Line No.

    Do you have a line no field? how are you having it increment?

    I have a line no. field and I am incrementing it manually in the subform...
  • vijay_gvijay_g Member Posts: 884
    No need to write even a single line code just set the data type of that field integer and set the autosplit property to yes.
  • poppinspoppins Member Posts: 647
    vijay_g wrote:
    No need to write even a single line code just set the data type of that field integer and set the autosplit property to yes.

    I did what you said but the problem is still here: when inserting many lines, only the last one is stored in the table ](*,)
  • SavatageSavatage Member Posts: 7,142
    what do you mean by inserting. are you manually entering lines or is this some kind of import?

    and you removed the line no increment code?

    and you completely got out of the form/page and went back in before "inserting again"?
  • poppinspoppins Member Posts: 647
    Savatage wrote:
    what do you mean by inserting. are you manually entering lines or is this some kind of import?

    and you removed the line no increment code?

    and you completely got out of the form/page and went back in before "inserting again"?

    I am manually entering the line no.
    I didn't add any line no. incrementing code and I didn't remove any increment code....are you talking about standard code?where can I find it?
    Infact, I did what vijay_g said...it works fine with only one line, but if I try to add another one, I get the following error message:
    The line already exists: "No."=NT10000, Line No.=10000
    

    Whath shall I do?
  • SavatageSavatage Member Posts: 7,142
    did you set the autosplitkey to yes on the header or the subform?

    and you have setup the subformlink & subformid properly?
  • poppinspoppins Member Posts: 647
    Savatage wrote:
    did you set the autosplitkey to yes on the header or the subform?

    and you have setup the subformlink & subformid properly?
    I did set the Autosplit key in the subform to Yes and the last field in the primary key to type Integer.
    In the header, I set the PagePartID to the name of the subform
    I set the SubPageLink to "Group No."=FIELD("No.") (where "No." is the header no. and "Group No." is the corresponding field in the subform).

    Infact, when I try to insert more than one line at a same time, it looks like the line no. is not being incremented...but if I create one line at a time, close the page, open it again and add another line, the line no. is incremented (20000) and no error message is generated...

    Why is that?
  • SavatageSavatage Member Posts: 7,142
    Sounds strange that it works if you close the page between each item being entered.

    Did you play with other properties and didn't change them back?
    Have you added any code somewhere?
    Do you have the delayed insert property = yes?
Sign In or Register to comment.