Using Option types in a GET

I’m trying to GET a record from the Comments line table, however, I can’t figure out how to specify that I want comments for a particular customer. I’ve coded the statement GET(‘Customer’,“No.”) however, whenever I run the form I get an error “The expression Text cannot be type-converted to a option value”. This is obviously because the value I am using in the first part of my get is not an Option, but how should I code this correctly? I’ve tried including Customer in various quotes (single, double, none) and using numeric values for the option position but still no joy. Can anyone help please? Thanks in anticpation

Use all fields in the table’s primary key in a GET statement. Example: comm.GET(comm.“Table Name”::Customer , ‘8059’, 10000); Note how the option is coded. Alternatively you can use the numeric option value (0, 1, 2 etc). //Pelle

Hi Pelle Thanks for the reply. That example works exactly as described However, how do I avoid using all the fields in the primary key? I just want to find if there is a record on the comment table for Customer XYZ. Thanks again

comm.SETRANGE(“Table Name”, comm.“Table Name”::Customer); comm.SETRANGE(“No.”, ‘XYZ’); if comm.FIND(’-’) then message(‘There is at least one comment on XYZ’); //Pelle

You can also use: comm.SETRANGE(“Table Name”, comm.“Table Name”::Customer); comm.SETRANGE(“No.”, ‘XYZ’); MyCount := comm.count; message('There are ‘+format(mycount)+’ comments); If you want the use to know the number of comments.

Cheers Fellas Schoolboy error. I’d used SETFILTER instead of SETRANGE as in your examples but on the subsequent FIND statement, because I’d copied it from an earlier GET in my code, I’d omitted the (’-’), it therefore wasn’t working. Funny that! Thanks again