How to SET new key to RecRef

ajaybabuChajaybabuCh Member Posts: 208
Hello


recRef.OPEN(122); -- opening the Purch. Inv. Header

FldRef := recRef.FIELD(44);--- Order No field ref
FldRef.SETRANGE('106015');--- filtering the Purch. Inv. Header table with the Order Number Value.
IF recRef.FINDFIRST THEN;

recRef is using the default primary key or the Purch. Inv. Header Table.

I would like to set a new key that is Order Number , to search for the records effectively by FldRef.SETRANGE('106015');

Can anybody help me how to SET new key to the recRef

Thanks and Regards
Ajay
Ajay

Comments

  • garakgarak Member Posts: 3,263
    Try to use
    REcRef.CURRENTKEYINDEX
    
    ;-)

    Regards
    Do you make it right, it works too!
  • ajaybabuChajaybabuCh Member Posts: 208
    Thanks garak

    I need some sample code for the following

    If I have the field number in the current table , for example take field number 44 (Order No.) in Purch. Inv. Header table.
    I would like to get the key index which will contain the field number 44 from the current table pointing by the RecRef.
    Ajay
  • kinekine Member Posts: 12,562
    Just search for example for using KeyRef. E.g. http://www.mibuso.com/dlinfo.asp?FileID=895
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • garakgarak Member Posts: 3,263
    sometimes its very easy to open the C/AL Editor and press F1 on the selected function. So, you get the halp and a example, also for REcRef .

    Regards
    Do you make it right, it works too!
Sign In or Register to comment.