7 Replies Latest reply on Feb 16, 2010 11:47 AM by philmodjunk

    Simple Report Problem

    3WaveGuy

      Title

      Simple Report Problem

      Post

      First Time to program a report.

      I have fields called name (text) and outdate (date), and I want to display all records where outdate < currentdate-x days.

      I am not sure how to make a record display that matches a condition.

       

      Huh, I solved this by making it a found set using current date. Good.

      But, my underlying quest remains: In the trigger script for testing a field, how do you say, ok this record can be in the report and this record is omitted?

       

        • 1. Re: Simple Report Problem
          philmodjunk
            

          Define a gobal date field gCurrentDate. (Make fields global by selecting that option from the Storage tab in Field Options)

          Define a global number field, gDaysPast for the number of days in the past the user wants to specify.

           

          In a script:

           

          Enter Find mode []

          Set field [YourTable:: outdate; "<" & YourTable::gCurrentDate - gDaysPast ]

          Perform Find[]

          • 2. Re: Simple Report Problem
            3WaveGuy
              

            Thanks it worked. So for finds do we always make global variables from fields?

            OK. So if I wanted to see only records with nodate (empty fields) how would I do that please?

            Is there a good resource to learn this. I bought the filemaker 10 bible but it so far has not helped (as a reference tool).

             

             

            • 3. Re: Simple Report Problem
              philmodjunk
                

              Global fields are convenient for this but there are other ways that work with non-global fields.

               

              Ever notice that all your data fields go blank when you enter find mode? With a global field on the layout, you'll find that it doesn't go blank. Thus you can place a field on the layout for the user to enter information and it's still there when you are in find mode so that the set field will work correctly. If you want to use data in a non-global field, capture the data in a variable first:

               

              Set Variable [$criteria; Value: Table::Nonglobalfield]

              Enter FInd mode[]

              Set field [Yourtable::fieldtoSearch; $Criteria]

               

              TO find all instances where a field is blank:

               

              Set Field [YourTable::Field; "="]

               

              (You can also use = this way when doing a find by hand.)

              • 4. Re: Simple Report Problem
                3WaveGuy
                  

                Hi,

                Spoke too soon in closing this, sorry.

                I tried Set Field [YourTable::Field; "="] and it showed 6 records and one had a date in it (the only one with a date) so it appears to be giving all records.

                I did it manually with the find and I got all 6 records also.

                I first tried "=" (in the manual find) but it gave me an error saying it needs to be date format so I took out quotes and it contued, but still showed 6 records.

                • 5. Re: Simple Report Problem
                  LaRetta_1
                    

                  PhilModJunk wrote:

                  Define a gobal date field gCurrentDate.


                  There is no need to make the current date a global.

                   

                  Set field [YourTable:: outdate; "<" & Get ( CurrentDate ) - gDaysPast ]


                  • 6. Re: Simple Report Problem
                    3WaveGuy
                      

                    Hmm, I will try to clarify:

                     

                    Enter Find Mode

                    Set Field [YourTable:: field1; ...07/01/2010]

                    I Perform Find, I Enter Preview Mode [pause] ......   and the records display yielding 5 records (4 with field2 null and 1 with field2 1= 2/01/2010.

                     

                    When I add Set Field [YourTable:: field2; "="]

                    I Perform Find, I Enter Preview Mode [pause] ....... and the same records display yielding 5 records (4 with field2 null and 1 with field2 1= 2/01/2010.

                     


                     

                    • 7. Re: Simple Report Problem
                      philmodjunk
                        

                      Thanks for the upgrade on my post LaRetta :smileywink:

                       

                      Enter Find Mode

                      Set Field [YourTable:: field1; ...07/01/2010]

                      I Perform Find, I Enter Preview Mode [pause] ......   and the records display yielding 5 records (4 with field2 null and 1 with field2 1= 2/01/2010.

                       

                      You've got a problem here. Set Field [YourTable:: field1; ...07/01/2010] is not in a format I nor LaRetta suggested. 07/01/2010 is interpreted by filemaker as 7 divided by 1 divided by 2010. If you want to use a literal date, you have to tell filemaker that it's a date, not a division expression.

                       

                      Set Field [YourTable::field1; "<" & Date (7 ;1 ; 2010) ]

                       

                      Note that an empty field will be less than a specified date.

                       

                      Adding Set Field [YourTable:: field2; "="] should find only records where field2 is blank. Which is not what you report. Can't tell why from your description. Perhaps there's an issue with your layout. Posting your file to a share site so we can look at it might be the best way to figure that part out.