get currentkey?

MagnoMagno Member Posts: 168
edited 2005-06-23 in Navision Attain
Hi,

you all know there exists a function to copy the filters from a record. it is called COPYFILTERS.

But does there exist a function to copy the key?

Can you just use rec2.SETCURRENTKEY(rec);
i also noticed there is a property on the rec with the name CURRENTKEY.
But help doesn't provide enough help for me.


Any suggestions or solutions?

Thx already
There are no bugs, only random undocumented features...
---
My Blog: http://NAV-Magno.be

Comments

  • DenSterDenSter Member Posts: 8,307
    Have you tried RecOne.SETCURRENTKEY(RecTwo.CURRENTKEY)?
  • MagnoMagno Member Posts: 168
    yes, already tried, currentkey returns a string with the key. while SETCURRENTKEY requiers a field as parameter
    There are no bugs, only random undocumented features...
    ---
    My Blog: http://NAV-Magno.be
  • DenSterDenSter Member Posts: 8,307
    From F1 help:
    COPY (Record)
    Use this function to copy a record from a C/SIDE table. All filters, marks, and keys are included in the copy.

    Record.COPY(FromRecord)
    Record

    Data type: record

    The record where the copy should be placed.

    FromRecord

    Data type: record

    The record you want to make a copy of.
  • Timo_LässerTimo_Lässer Member Posts: 481
    Another way could be
    MyRec.SETVIEW(YourRec.GETVIEW(FALSE));
    
    This will also copy all filters and the currentkey to the other Record Variable.
    Timo Lässer
    Microsoft Dynamics NAV Developer since 1997
    MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
  • MagnoMagno Member Posts: 168
    indeed, the last one works and is the shortest, thx
    There are no bugs, only random undocumented features...
    ---
    My Blog: http://NAV-Magno.be
  • pdjpdj Member Posts: 643
    MyRec.SETVIEW(YourRec.GETVIEW(FALSE));
    
    This will also copy all filters and the currentkey to the other Record Variable.
    Not quite. It only copies the filters in the current filtergroup. In most cases not a problem, once in a while it may turn out to be a critical error. So why risk it :-)
    Regards
    Peter
  • MagnoMagno Member Posts: 168
    sorry, looked wrong,

    indeed the copy is the better one, even marked works
    There are no bugs, only random undocumented features...
    ---
    My Blog: http://NAV-Magno.be
Sign In or Register to comment.