Moving through records

Eric.ReynoldsEric.Reynolds Member Posts: 3
edited 2003-09-18 in Navision Attain
I have created two buttons on a form. One has a bitmap of an UP arrow and the other of a DOWN arrow. I would like for the buttons to be able to move the current line the user is on up or down.

For example, the user is on a purchase order. The cursor is on the second line. The user clicks the UP arrow to switch the second line with the first. I can make this happen by deleting the lines and recreating them switching the line numbers. The problem is that the focus is still on the second line and did not move up with the switch. The primary key of the second record is still the same, but the detail is changed. If I keep the primary key the same and cause the first line to have a greater line number then the second it will work. But this will not work for me.

I have tried to just figure out how i can cause the buttons to move up and down to different records within the form but every time I do this I get the message "Do You Want To Rename the Record". If someone could help with just this issue I have an idea of how I can get the rest to work.

Thanks
Eric

Comments

  • SbhatSbhat Member Posts: 301
    Hi Eric,

    You might have to use a temporary table to do this. When the user click the arrow keys, you may have to copy the record and then write it to the temporary table and then write it back to the regular table. You might have to delete the records in regular table when you copy thre record to the temporary table.

    Thanks
    Best regards
    Suresh.
    New York.
  • Eric.ReynoldsEric.Reynolds Member Posts: 3
    I might be misunderstanding you but...
    I am currently doing that. The records are copied to two diff temporary variable. The actual recrds are deleted and then the informtion is copied back from the temporary tables switching only the line numbers. This works great.

    The issue is i want the record that the user was on to continue to have focus. When the user clicks on up, the records are switched, but the cursor is still on the same line and the record that they were on is the one above. Currently the user will clik the up arrow and the records will switch, he/she will have move the cursor up to the original record before the line can be moved up again.

    The User is on line 7 and wants to move it up to line 2:

    Current - Click on line 7 -> click on up arrow -> Click on line 6 (this is to set focus on what was line 7 but is now line 6) -> click the up arrow moving the line to line 5 -> click on line 5...and so on until the line is at line 2. This is two click per move.

    What I want to happen - click on line 7 -> click on up arrow, the cursor has now followed the record and line 6 has focus -> click on the up arrow the line is moved again and the cursor is moved with it...repeat until the line is at line 2. This only requires that the user clciks the up arrow until the line is in the deired position.

    Thanks
    Eric
  • Torben_R.Torben_R. Member Posts: 99
    I had a simular wish from a customer once.

    I solved it this way:
    In the temp. table I added a new field LineNo (Integer) and a new key LineNo.
    If you change all the LineNo's when the user press Up or Down you will have the sequence and when you transfer the records back to the original table you sort by LineNo.

    Regards
    Torben
Sign In or Register to comment.