Filemaker Find Script ( A and B and C)

I'm trying to do a find in Filemaker where name = "John" and Join date is greater than Jan 1 2020 and Less than Jan 1 2021. I tried the below code but it doesn't seem to work on the date constraint.

Here's my code so far:

Enter Find Mode [Pause:Off]
Set Field [mydb::Name; "John"]
Perform Find[]

Enter Find Mode [Pause:Off]
Set Field [mydb::Date; ">=" & "2020-01-01"]
Constrain Found Set [] 

Enter Find Mode [Pause:Off]
Set Field [mydb::Place; "<=" & "2021-01-01"]
Constrain Found Set [] 

1 answer

  • answered 2020-10-16 07:49 michael.hor257k

    First, if those conditions are cumulative, they can and should go into the same find request. Next, expressing a date as a "YYYY-MM-DD" string will only work if your file is set to use the YYYY-MM-DD date format (which is fairly rare). And finally, you can use the range operator to find a value between two points.

    So:

    Enter Find Mode [ ]
    Set Field [ mydb::Name ; "John" ]
    Set Field [ mydb::Date ; Date ( 1 ; 1 ; 2020 ) & ".." & Date ( 1 ; 1 ; 2021 ) ]
    Perform Find [ ]
    

    Note that a range find is inclusive; in the above example, both Jan 1, 2020 and Jan 1, 2021 will be found.