Jump 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.

GetAsDate() fixes issue, but why?

Featured Replies

I have a field called accInterestEndDate with the following calculation:

Let (

[

~nextEntry = GetNthRecord ( date ; Get ( RecordNumber ) + 1 )

] ;

Case (

IsEmpty ( ~nextEntry ) ;

portfolioDate ;

Min ( ~nextEntry ; portfolioDate )

)

)

In the first record, date equals 01.01.2011. In the second record, date equals 02.02.2011. portfolioDate is a global field that equals 06.11.12.

With the above calculation, accInterestEndDate in the first record should be 02.02.2011. However, it calculates to 01.01.2011 ( its own date field).

I can fix this by changing the variable ~nextEntry to GetAsDate ( GetNthRecord ( date ; Get ( RecordNumber ) + 1 ) ). Then the correct result of 02.02.2011 appears. However, I don't understand why this fixes the problem and I don't like implementing a solution without understanding it.

Now where it gets really strange. I added a field calleddateNextRecord which has the calculation GetNthRecord ( date ; Get ( RecordNumber ) + 1 ), without wrapping it in GetAsDate(). Then, I have the field accInterestEndDate with the following calculation:

Case (

IsEmpty ( dateNextRecord ) ;

portfolioDate ;

Min ( dateNextRecord ; portfolioDate )

)

Strangely enough, this calculates correctly.

My understanding of the GetAsDate() function is that it will convert text to a date. However as the date field in the portfolio date field are already formatted as date fields, I don't understand why this corrects the error. Any input would be helpful.

Please see attached file.

DateCalc.fp7.zip

Create an account or sign in to comment

Important Information

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

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.