jump to new record

jam176jam176 Member Posts: 27
edited 2005-09-30 in Navision Attain
hi all!

i'm looking for a possibility to jump to a new record. i've tried out several ways but had bad look so far.

at last i did the following:
    rec.FIND('+');
    rec.NEXT;

but navision ignores the next command. and a function like
rec.NEW;
does not exist! can anyone help me?
thx
jam176

Comments

  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    In order to make a new record you need to clear the varable
    Rec."No." := '';
    Rec.INIT;
    Rec.INSERT(TRUE);
    

    This works for tables with the "No." field as primairy key. Such as the Contact, customer, vendor and Item table.

    If there is a more complex key like the salesheader you need to clean the complete key.
  • jam176jam176 Member Posts: 27
    well, this is a possibility, i confess! but if i do so, the record is really written to the table. this is not what i want at that time.

    the code should do nothing else, then set the recordmarker to a new, initial and unposted record. same as i scroll down a table until i come to the new record, right behind the last one.

    then the user can fill up the fields, if he want's to do so. if not, no record will be written.
    thx
    jam176
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Could you please give more information about for what reason you want to do this.

    Normaly the user can use F3 and Navision performs this task. Why can't you use the F3 functionality?
  • jam176jam176 Member Posts: 27
    of course i can:

    there is a special table i created to prepare relations between production orders. at the moment only a few fields are defined. the production number, 3 fields for production order numbers (which belong to each other) and some others.

    by doing this the 3 production order numbers are combined under the production number.

    users should be able to see this table in a form which is normally not editable to avoid changings by mistake. but if one single user with special rights wants to insert a new production number to assign production orders, i provide a button named "New..." for him. he can click this button and that's the point:
    with the onpush event the form should become editable and the cursor should jump to a new record!

    i think my whish is absolutely unspectacular, but i can't find a solution for navision attain.
    thx
    jam176
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    I think you are being to nice for the user. I don't think it is possible to simulate the F3 fucntionality, exept when you simulate this button pushed.

    If you want this you can search this forum, there are some topics about it.

    You can also leave the form uneditable and make some function that creates the record via a report, you can use the request form for the user input. After the report you can jump to the record.
  • jam176jam176 Member Posts: 27
    ha! i know, i'm always too kind! :D

    anyway, i will only switch the form to editable mode and the user should press F3 to insert his new record.

    but do me a favour and tell me: isn't it strange, that navision does not provide a function for such a simple thing???
    thx
    jam176
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Navision does many things a bit strange. You get used to is after a couple of years.

    Quote (MBSOnline.org):

    And most importantly - remember this is Navision, don't fight it, its just different, doing it the Navision way will make life much easier for you.
    David Singleton
  • jmjm Member Posts: 156
    jam176 wrote:
    , i provide a button named "New..." for him. he can click this button and that's the point:
    with the onpush event the form should become editable and the cursor should jump to a new record!

    this is possible in Navision:
    1. create a function in your form with the following code:
    - check the requested rights
    - clear the "Rec"-variable
    - fill the primary key of "Rec"
    - Call Rec.INSERT(TRUE)
    - Set xRec."primary key fields" to Rec."primary key fields"
    - Set form to Editable
    - call CURFORM.UPDATE
    2. add a menu item to call this funtion (with ShortCutKey = F3)

    br
    Josef Metz
    br
    Josef Metz
Sign In or Register to comment.