Search code examples
visual-foxprofoxpro

Browsing the year in a string


So I have a field containing dates; however not all years are the same. How do I browse for a specific year. I have tried the following, but it doesn't really work.

BROWSE FIELDS Lastcall FOR Lastcall LIKE '%2019%'

thanks in advance


Solution

  • OR.. exactly as you had it which will allow you to directly edit the records too. IF the "LastCall" is a date based field

    BROWSE FIELDS Lastcall FOR year( Lastcall ) = 2019
    

    if it is a string field, you could do

    BROWSE FIELDS Lastcall FOR '2019' $ Lastcall
    

    The "$" means does the string on the left exist anywhere in the field on the right (which you could concatenate multiple string fields if you so wanted to.