5 Replies Latest reply on Oct 28, 2011 11:10 AM by BDH

    Minute calculation

    BDH

      Title

      Minute calculation

      Post

       

      Dear Sir, We track our sales person via there working time and place. 2 fields are given below:

      Field 1: "Area" -- -------- Field 2: "Time"

      1. Belmore Rd, Belmore      10:50 AM

      2. Belmore Rd, Belmore      11:00 AM

      3. Belmore Road, Belmore    11:25 AM

      4. Morningside Pde, Sydney  11:30 AM 

      5. Morningside Pde, Sydney  11:42 AM

      6. Morningside Pde, Sydney  11:52 AM

      What we want to do is - Calculate the minutes between one area to another (Although it is same area) e.g. serial 2's time 11:00 AM minus Serial 1's time i.e. 10 minutes in the third field. In excel we can do it easily by = if(Area1=Area2,Time2-Time1,0) and drag it till the end. But in filemaker we can not find anyway to calculate with above row records. Thanks for your kind help. Regards,Tohid. 

        • 1. Re: Minute calculation
          philmodjunk

          If ( GetNthRecord ( Area ; Get ( RecordNumber ) - 1 = Area ; Time - GetNthRecord ( Time ; Get ( RecordNumber ) - 1 ) )

          Make time your result type if you want to format the field on your layout to show minutes.

          If you choose number, as the result type, you will also need to divide by 60 to convert elapsed seconds into minutes.

          • 2. Re: Minute calculation
            BDH

            Such an active forum!! Replies within minutes.... Thanks.

            I am getting this error "There are too many parameters in this function"

            • 3. Re: Minute calculation
              BDH

              Do I have to create a field named "RecordNumber"?

              • 4. Re: Minute calculation
                philmodjunk

                My mistake, left out a parenthesis:

                If ( GetNthRecord ( Area ; Get ( RecordNumber ) - 1 ) = Area ; Time - GetNthRecord ( Time ; Get ( RecordNumber ) - 1 ) )

                "RecordNumber" is a parameter passed to the Get function to tell it what value to "Get". If you look up Get Functions in FileMaekr Help, you'll find that there is a very long list of parameters you can use with it to get all kinds of different values.

                Also, make sure that this calculation field reads as "unstored". You may need to click the storage options button to select that option.

                • 5. Re: Minute calculation
                  BDH

                  Lovely!

                  Thanks for your quick & accurate reply...