GET function

If a table has the primary key made up of three values, can I use get for only one value?
e.g.: PK: (number,name,city).
How can I use the GET function if I have only the number? Thank you

Answers

  • da_nealda_neal Member Posts: 76
    No. You can SETRANGE(number,'Value') and FINDFIRST.
  • krikikriki Member, Moderator Posts: 9,094
    Actually you can do GET('VALUE 1') but that means NAV considers the other fields of the primary key the blank value ('' for text/code, 0 for int/dec, 0D for date,...)
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • vaprogvaprog Member Posts: 1,116
    Be carefull. GET accepts one argument, even if the primary key consists of three fields, but GET uses the init value for those fields, not prowided (not sure if it uses the field's init value, or the type's, but you shouldn't use this anyway, just be aware that you won't get an error if you use too few parameters.

    In your case, you need to use SETRANGE, and carefully think about what you should do if there are more than one records matching. IF you don't care, or are sure for business logic reasons, that only one can exist, use FINDFIRST, as da_neal suggested. otherwise use FINDSET and NEXT.
Sign In or Register to comment.