1 Reply Latest reply on Mar 21, 2011 11:50 AM by philmodjunk

    Display only limited records in layout

    RamjiEnamuthu

      Title

      Display only limited records in layout

      Post

      Hey,

      In my database table, I have 6000+ records from four different years. I have created a data entry layout to display this data and also view the data. I would like to display only records of one particular year at a time. Very rarely a user goes back to viewing previous years' data. Hence, I would like to display 1500+ records of the current year and then if the user wishes (say changes the value of an input field) then I would like to display other records.

      Is this possible? Can you please tell me how can I implement this in FM Pro 11?

      Thanks,

        • 1. Re: Display only limited records in layout
          philmodjunk

          This script would find the current year's records:

          Enter Find Mode[]//clear the pause check box
          Set Field [Yourtable::YourDatefield ; "*/*/" & Year ( Get ( CurrentDate ) )
          Set Error capture [on]
          Perform Find[]
          Sort [Restore; no dialog] // sort them if you need a specific sort order

          This script would find the records from the previous year:

          Set Variable [$PrevYear ; Year ( YourTable::YourDateField ) - 1]
          Enter Find Mode[]
          Set Field [Yourtable::YourDatefield ; "*/*/" & $PrevYear )
          Set Error capture [on]
          Perform Find[]
          Sort [Restore; no dialog] // sort them if you need a specific sort order

          This second script could be attached to a button and clicking it takes you back one year at a time. A similar script could move you forward.

          You can also use a value list formatted global field for the year and do it this way:

          Enter Find Mode[]
          Set Field [Yourtable::YourDatefield ; "*/*/" & YourTable::GlobalYearField)
          Set Error capture [on]
          Perform Find[]
          Sort [Restore; no dialog] // sort them if you need a specific sort order

          Note that all of these scripts are very similar. It's possible to use one scirpt for all of these options, but pass the desired year as a parameter to it instead.