7 Replies Latest reply on Apr 17, 2017 12:45 PM by mikebeargie

    IF Condition

    garry107

      Hi all,

       

      I have been given a task of creating a report for a table.

       

      Preview of layout 1

       

      field 1 = yes or No (Checkbox)

      field 2 = start date( drop down calender) eg: 5/22/2017

      field 3 = end date( drop down calender) eg : 5/22/2022

      field 4 = all the years between start date and end date ( calculation) eg: 2017,2018,2019,2020,2021,2022

      and some other fields

       

      so the report I need should be

       

      field 1 = dropdown of +50 and -50 years. eg: 1975-2075

      so if the year selected in field 1 (in the record) matches in any year in field 4 in the previous layout then i want some other fields in the respective records.

       

      How can I achieve this.

       

      Thanks,

      Garry.

        • 1. Re: IF Condition
          coherentkris

          Logical operators - FileMaker Pro 15 Help

          Comparison operators - FileMaker Pro 15 Help

          Case - FileMaker Pro 15 Help

          IF - FileMaker Pro 15 Help

           

          These are the bricks from which you will build your logical statements.

          If you have to evaluate more than one or two conditions i would strongly reccoment case rather than nested if ... then...else if statements

          • 2. Re: IF Condition
            philmodjunk

            If the years in field 4 are separated by returns, it could be used as a match field in a relationship to your dropdown list of years field. Then go to related records could be used to find the records for your report.

            • 3. Re: IF Condition
              garry107

              but where do I implement them when it comes to reports. I am new at this.

              • 4. Re: IF Condition
                mikebeargie

                Doing the find can be scripted easily, you don't need to use logical operators. You say field 1 is a checkbox, but then it's used as a date selection. Let's assume for now it's not a checkbox, and is in fact, a date selector that will be used for the report.

                 

                Say for instance I wanted a "+/- 50" button, based on the current selected record from my table, and navigating to a report layout:

                Set Variable [ $selected ; YourTable::field1 ]
                Enter Find Mode [no pause]

                Go To Layout [ Report Layout]

                Set Field [ YourTable::field2 ; "1/1/" & Year($selected) - 50 & "..." & "12/31/" & Year($selected) + 50 ]

                New Record/Request/Page

                Set Field [ YourTable::field3 ; "1/1/" & Year($selected) - 50 & "..." & "12/31/" & Year($selected) + 50 ]

                Perform Find

                So essentially if I select a date of "4/12/2017", I do a find where the start date OR the end date falls within a +/- 50 year range based on that selected date.

                 

                Note I highlighted OR. In this case, adding a new find request between the two set fields makes it an OR search condition. If I wanted an AND search condition, the new request is removed, meaning that the start date AND end date would need to fall in the +/- 50 range.

                 

                So yeah, no need for filemaker's If() or Case() functions here. No need for the If/End If script steps either. It's a simple find based on a selected date.

                • 5. Re: IF Condition
                  garry107

                  Hey,

                   

                  I have been given a task of creating a report for a table.

                   

                  Preview of layout 1

                   

                  field 1 = yes or No (Checkbox)

                  field 2 = start date( drop down calender) eg: 5/22/2017

                  field 3 = end date( drop down calender) eg : 5/22/2022

                  field 4 = all the years between start date and end date ( calculation) eg: 2017,2018,2019,2020,2021,2022

                  field 5 = some data

                  field 6 = some data

                  field 7 = some data

                  field 8 = some data

                  and some other fields

                   

                  so the report I need should be

                  field 9 =  1975-2075 value list

                   

                   

                  if field 1 = "Yes" and  field 9 year is in field 4

                  then I want to show all records which satisfy the above condition and fill the below records one after another.

                  record number :

                  field 5 = some data

                  field 6 = some data

                  field 7 = some data

                  field 8 = some data

                   

                  How can I achieve this.

                   

                  Thanks,

                  Garry.

                  • 6. Re: IF Condition
                    philmodjunk

                    Mike has already answered your question. What additional issues are you having?

                    • 7. Re: IF Condition
                      mikebeargie

                      Yeah, please ask “specific” questions. Otherwise the answer is “use filemaker”?

                       

                      If I read correctly now, you want to fill out additional fields based on results of another? In that case it’s exactly the same, as what I posted before, but maybe with Replace Field Contents script steps, or setting those extra fields to be calculation fields based on the found set or global values.