Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

No of days since last entry

Featured Replies

I need to record "machine readings" taken on a periodic basis:

eg:

Date 10/7/2008 ; Reading 202

Date 13/7/2008 ; Reading 199

Sate 14/7/2008 ; Reading 170

etc

The dates are not necessarily taken every day, but the rate of change in the usage readings is affected by the amount of time that has passed

So on entering the second reading I also want to store the number of days since the previous reading ie 3

If reading 2 were deleted then I would want the "days" for reading 3 to change from 1 to 4.

Is it possible to have a calculation field do this or does it need to be some sort of script?

Any pointers please

many thanks

Simon

Edited by Guest

Hi Simon,

Calculation (result is number) and be sure it is unstored (in Storage Options) and that 'Do Not Evaluate If All Referenced Fields Are Empty' is UNCHECKED at the bottom of the calculation dialog:

Case(

  date ; 

    Case ( 

      Get ( RecordNumber ) = 1 ; 0 ;

      date - GetNthRecord ( date  ; Get ( RecordNumber ) - 1 ) 

    )

  )

LaRetta

  • Author

Thanks Laretta - (I was barking up the wrong tree using a self join and lookupnext/lower etc) - I have learned something thanks

Anyway could you help with a slight variation?

really we need the number of days since the previous reading's date as opposed to the previous record entered, as readings may not be entered chronologically

thanks a million

Simon

Edited by Guest

number of days since the previous reading's date as opposed to the previous record entered

Am I missing something here? Are these records with possibly a VehicleID and mixed with other vehicle readings? Otherwise why would they be out of sequence? Please clarify a bit more on what this table contains.

  • Author

The problem arises because the readings for a machine are taken by more more than one person depending on who is "on site" - those people need to update "my" system but do so the next time they are at head office... which may be out of order... hence the need to be able to record "out of date order"

By way of background:

The machines are bar code readers and the request is to record (for analysis) the number of times they have been used - which is available from the readers firmware. (not the number of sales scans etc which is covered by the application software)

Once the reading is taken the machines internal count is automatically zeroed...

Thanks for taking the time Laretta

Cheers

Simon

You just need to make sure your records are sorted correctly. However, this method can get slow as the number of records increases.

---

See clarification below!

Edited by Guest

  • Author

Oooh - because GetNthRecord works on found set based on the way the table has been sorted and its an unstored calc...

Re your comments about speed I think there will be about 840 readings per week at the outset - is there is an alternative method I could look at?

Thanks

Simon

there will be about 840 readings per week at the outset

That doesn't tell much - the question is how many will there be after a year, or two years, or...

The alternative is to perform a lookup/auto-enter when a record is created - but it also means that when a record is deleted/modified, you need to perform a relookup on subsequent records.

  • Author

Your perception completely passed me by :)

Yes there are several readers ids in the table

I have to ask - how do you change your calc to find the last reading for a given reader id?

Yours Simon

  • Author

Sorry - I can see you don't change the calc - its just about "finding" the correct found set and "sorting".

I will look at this some more - I think I am not getting to the bottom of the requirement properly

S

I need to clarify what I said earlier about the solution getting slow as the number of records increases. I was - quite mistakenly! - thinking this was a cascading dependency. But that is NOT the case here, because each record depends ONLY on the previous record's date, and that does NOT depend on anything else.

As with any unstored calculation, if you have a List/Table view with many records, it may take some time to show all the results. But the effect won't be anywhere as dramatic as it would be with a cascading dependency.

Thanks to LaRetta for insisting on an explanation!

  • Author

Many thanks for the clarification

Simon

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.