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.

Last Modified date for Invoice/LineItems

Featured Replies

Is there a scriptless way to calculate a single Last-Modified date for an Invoice with LineItems shown in a portal? A "modification" would include not only changes to an line item, but deletion and addition of line items as well.

Thanks,

Chap

Well, as far as deletion goes, I'm not sure how that would work, but for the rest of it you could do this.

Create one field in your data table (the one that you want to track modifications to) make it a global calculation with this calc:

Field gVariable1


Evaluate(Quote(Cieling(Random * 10000)); [field1; field2; field3; field4; field5])





make sure you have every field that you want to watch for modification in there where I have field1; field2.. ext. 



What this will do, is everytime a record(really just the fields you listed) is changed in any way (including addition of a new record) it will put a new number in there between 1 and 10000 (you can use any number you want, i just normally use 10000 because it looks nicer).



Now then, in your interface table, or the occurance your on when your viewing the portal, create another field called tsMod_Timestamp make it a calc with this Calculation:





Evaluate(Quote(Get(CurrentTimeStamp)); gVariable1)

Then, any time a record is added, or changed in any way, you'll get an updated timestamp.

As far as deletion goes, I'm not sure about that.

  • Author

Thanks - hadn't really thought about uses for Evaluate until now; that opens up a lot of possibilities.

I'm not quite sure why you didn't write


Field tsMod_Timestamp is Calculation

Evaluate(Quote(Get(CurrentTimeStamp)); [field1; field2; field3; field4; field5])

where tsMod_Timestamp is a field in the parent (Invoice) record and field# are fields in the related (LineItems) records.

I am afraid you will find that an auto-entered field will not update as a result of changes in related records.

Thanks - hadn't really thought about uses for Evaluate until now; that opens up a lot of possibilities.

I'm not quite sure why you didn't write


Field tsMod_Timestamp is Calculation

Evaluate(Quote(Get(CurrentTimeStamp)); [field1; field2; field3; field4; field5])

where tsMod_Timestamp is a field in the parent (Invoice) record and field# are fields in the related (LineItems) records.

I wasn't sure that would work with creation of records.

Comment:

This worked fine for me, but these are set up as calc fields not auto enter fields.

It doesn't really matter - what matters is if the calculation is stored or not. If it's stored, it won't update when related records are modified. If it's unstored, it can be be much simpler, e.g. Max ( related::LastModified ).

  • Author

Here's what I have so far:

Invoices::tsLastModified = Stored / Timestamp / Modification timestamp

LineItems::tsLastModified = Stored / Timestamp / Modification timestamp

Invoices::tsLineItemsLastModified = Unstored / Calculation / Max(LineItems::tsLastModified)

Invoices::tsVeryLastModified = Unstored / Calculation / Max(Invoices::tsLastModified ; Invoices::tsLineItemsLastModified)

The last field is what I want - seems to work okay for changes to Invoice, to any LineItems, or to the addition of a new LineItem. As zeroTol mentioned above, it doesn't work with LineItem deletion.

For that, I'm going to see if I can generate a timestamp when Count(LineItems::ID) changes, and include that in the Max() function for Invoices::tsVeryLastModified.

Any thoughts?

I think you will find it difficult to generate a timestamp when Count(LineItems::ID) changes. But you can restrict deletion so that the only way to delete a LineItem is by script - and the script can also write a timestamp.

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.