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.

Automatic Number Calculation with sub-numbers

Featured Replies

Hi all

I am stumped. I can do this with a script which sets the fields, but I would like it to be dynamic if possible.

I have a database of documents, there are main documents (eg. 1) and sub-documents (eg. 1.1).

When I sort these documents into date order, I would like the numbers to reflect the order with sub-numbers.

I am trying to find a calculation that will take the value of the previous field and add 1 if it is a maindoc or not if it is a sub doc.

My script basically loops through setting a global field to the documentID and then if the document is a main document it adds 1 to the global else it sets it to the global.

Can this be done with a calculation? apendnth maybe?

Any help would be greatly appreciated.

Zippy

Zippy,

We meet again, but not over cups steaming php this time!

Here's a thought:

if you build a sorted relationship so each record can see the record prior to it in your found set, this would give a calculation a basis for determining what value to output.

It's been a little while since I had to dig deep into what could and could not be calculated. There may be a problem with calculating from related data like that...

But maybe that will spark some ideas.

Regards,

Don

  • Author

Solved (I think).

I have had to use two fields. The first calculates the Main Number and then second appends the sub-number.

I have called the field AutoNumber and it references itself.

Case (

Get ( RecordNumber ) = 1 ; 1;

IsEmpty (SubNumber) ; GetNthRecord ( AutoNumber ; Get ( RecordNumber ) - 1 ) + 1 ;

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

I then have a field called CalcNumber which is

AutoNumber & If ( IsEmpty (SubNumber) ; "" ; "." & SubNumber)

It all seems to work ok ... now to put it into practice and see how it performs

ZP

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.