how to filter two fields

Record.SETRANGE(Field [,FromValue] [,ToValue])// this is the setrange functon syntax

ZIPCGRec.SETRANGE("Post Code",ZIPCGRec."From Zip",ZIPCGRec."To Zip");//this is my form syntax
here post code is a field not in ZIPCGRec table....is my code is correct or wrong

Answers

  • RockWithNAVRockWithNAV Member Posts: 1,139
    ZIPCGRec.SETFILTER("Post Code",'%1|%2',ZIPCGRec."From Zip",ZIPCGRec."To Zip")

    It will take just two filters.
  • Vazid_490Vazid_490 Member Posts: 52
    Thank you,
    but it print only table first value.this code is didn't filter
  • vaprogvaprog Member Posts: 1,140
    edited 2016-08-06
    Vazid_490 wrote: »
    ZIPCGRec.SETRANGE("Post Code",ZIPCGRec."From Zip",ZIPCGRec."To Zip");//this is my form syntax
    here post code is a field not in ZIPCGRec table....is my code is correct or wrong
    If "Post Code" is not a field in the ZIPCGRec table you'll get a compilation error.

    It is somewhat suspicious that you use values from the same table/record as filter parameters on which you set the filter.
    Vazid_490 wrote: »
    but it print only table first value.this code is didn't filter
    How did you retrieve the records?
    Vazid_490 wrote:
    how to filter two fields
    in your code you're setting a filter on one filed using two filter parameters. Is that what you need or do you need the opposite: finding the record with "From Zip" <= "Post Code" <= "To Zip"?
  • archer89archer89 Member Posts: 337
    hi, please describe in detail what you need, what you want to do. please describe the meanings of the variables post code, from-zip, to-zip.
    best regards
    Franz Kalchmair, MVP
    Alias: Jonathan Archer

    please like / agree / verify my answer, if it was helpful for you. thx.
    Blog: http://moxie4nav.wordpress.com/
Sign In or Register to comment.