Retrieving record with field that isn't the primary

JamieBrown
JamieBrown Member Posts: 107
Hi,

Is there anyway I can do a 'GET' on a record with a field that isn't the Primary?

For example:

Storeqty's primary key = Location,Item No.,Variant Code
Storeqty.GET(Item."no.");

Is there a way around this?

Thanks in advance.

Answers

  • kriki
    kriki Member, Moderator Posts: 9,127
    Storeqty.RESET;
    Storeqty.SETCURRENTKEY("Location","Item No.","Variant Code");
    Storeqty.SETRANGE("Item No.",Item."no.");
    IF Storeqty.FINDFIRST THEN ; //avoid error if it doesn't exist
    or 
    Storeqty.FINDFIRST; // raise error if it doesn't exist
    

    If are before 4.00SP1, then use FIND('-') in stead of FINDFIRST.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • JamieBrown
    JamieBrown Member Posts: 107
    Thanks Kriki.