Field

fahdfahd Member Posts: 226
Dear Experts,
In item card there is a field called Vender no. I've created one form which is desinged on the base of Table no. 37 Sales line.

But in that form i want that Vendor no. field. I have tried to created new variable named item within that form. i gave the datatype
as RECORD and i gave source expression as ITEM.VENDOR NO.

but it is not coming in that form.

Please tell me that how can i bring the field Vendor no. in my newly created form which is designed on (Table 37 Sales Line).

i know vendor no. field is not part of Table 37 but i need that field in my newly created form.

Waiting for earliest reply.

Thanks & Regards,
Fahd

Comments

  • SavatageSavatage Member Posts: 7,142
    So you want to add "Vendor No." to the sales line table.
    First add the field "Vendor No." to the table - Code(20) (50000+ range)

    If you look at the code behind the sales line table you will see
    OnValidate of "No." that many fields are filled.

    What you're looking for is the part where it says...

    Type::Item:
    .....
    .....
    .....
    you will see other item fields tax groups, posting groups, etc being transfered.
    You would add
    "Vendor No." := Item."Vendor No.";

    The "GET" is already been fired so you don't need that here.

    **now if you want this "Vendor No." field value to transfer over to the posted Invoice & Shippments,
    You'll have to add the same Field to those other tables - using the Same Name & Number & Size.
  • fahdfahd Member Posts: 226
    Dear Savatage,


    First of all thanks for such a detailed reply. :)


    I have tried adding up a field in Sales Line table. But it says "your license does not allow you to create a field". Even i have used the developer license.

    My license only allows me to add the field up in Table 27 Item.

    I was wondering if without creating field in Sales line table. Suppose if i want to create a form based on Sales line table. Can i bring the vendor no. field in the form??? if yes then please bear with me and let me know.


    Thanks & Regards,
    Fahd
  • thmartinthmartin Member Posts: 90
    You can do it on the form with a variable as you tried it. Basicly you need to put the Item.GET("No.") in the OnAfterGetRecord trigger of the form + checking if the Type is Item.
    Thomas Martin
    NAV Developer
  • fahdfahd Member Posts: 226
    Dear Thumartin,

    Thanks :)!!!

    But, I created on variable named ITEM, i selected that data type as a RECORD & subtype as ITEM.

    Then i came to the ONGETAFTERRECORD TRIGGER.

    I mentioned like this.

    item.GET ("Vendor no.");

    but its is saying unknown variable "VENDOR NO.".

    Please tell me more i think i m making mistake somewhere?


    Regards,
    Fahd
  • SogSog Member Posts: 1,023
    it's more like
    if type = type::item then //<- sales line has to be type item or you'll get for example item.get(g/l account number)
    item.get("No."); <- get is the function where you GET a record with parameters primary key (vendor no. is not a primary key)

    item."vendor no." => your wanted data

    But I really suggest to take a look at documentation, msdn, and other training materials.
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • SavatageSavatage Member Posts: 7,142
    fahd wrote:
    I have tried adding up a field in Sales Line table. But it says "your license does not allow you to create a field". Even i have used the developer license.

    My license only allows me to add the field up in Table 27 Item.
    :-k

    what filed id number are you using?
  • fahdfahd Member Posts: 226
    Dear Savatage,
    It's generating itself the new field number after the last one. I know there is some specific series of numbers that i can start with. But i don't know from where that series starts. so i just started the next generated number.
  • BeliasBelias Member Posts: 2,998
    Savatage wrote:
    So you want to add "Vendor No." to the sales line table.
    First add the field "Vendor No." to the table - Code(20) (50000+ range)
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • SogSog Member Posts: 1,023
    The ranges of fieldnumbers you can use in standard tables are 50000-99999.
    This information can be retrieved from standard learning materials.
    And although NAV generates a fieldnumber, they are suggestions, they will always be the number of the previous field (one row above) +1 unless that number is already assigned. Then it will choose the next available number in that range.

    I (and I think I can say We) recommend learning materials and training to gain knowledge of C/Side.
    Also, could you please confirm you are not working on any real NAV projects? At least not until you've gained (much) more experience.
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • fahdfahd Member Posts: 226
    Dear Mr. Savatage,


    Thanxxxxxx alottt. It's done. now it i showing me the field now, I really appreciate your help sir. thanx every one as well.
  • SavatageSavatage Member Posts: 7,142
    FYI: the reason I mentioned the code should be added in the section after
    Type::Item:

    is that if it's just anywhere you run into the problem of Item.Get("No.") failing.
    like if you use a g/l account no for example.

    So by executing the code when you know the "NO" has to be an item number solves that.

    Else you should use a If Item.Get("No.") then...else.....
    to avoid a crash.

    Just some extra info you can keep in mind as I saw you were having problems understanding the "GET".
    It's the little things.
    :)
  • fahdfahd Member Posts: 226
    Dear Mr. Savatage,

    Really appreciate your help thanks alot for that :).
Sign In or Register to comment.