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.

Calc relationship summary

Featured Replies

I'm having problems with one of my calculations.

What I'm trying to do is this:

Database 1 records individual transactions. I have a relationship from Database 2 to Database 1, and that relationship is called "NDirectMutualFunds." I have a calculation field on Database 2 that uses the following calculation:

"Case[NDirectMutualFunds::PayDate >= DateRange1 and NDirectMutualFunds::PayDate <= DateRange2 , Sum[NDirectMutualFunds::AmtExpected],0)]"

NOTE: The brackets in that calculation represent parentheses, but for some reason I couldn't use the parentheses in this post.

My goal is for the calculation -on Database 2- to summarize a particular field -AmtExpected- which resides on Database 1. The trick is that each record on Database 1 contains a date field -PayDate-, and I only want the calculation to summarize those records whose PayDate field falls in a date range which I set. You can see I tried to express that in the case statement at the beginning of the calculation. FYI: DateRange1 and DateRange2 in the calculation are the fields I use to enter the date range.

The calc is so close to working, but it has one little glitch. It only evaluates the PayDate field on the first related record. If, on the first record, the Paydate field is within the date range, then all the records are summarized regardless of whether or not the PayDate fields on the other records are within the date range. If, on the first record, the Paydate field is not within the date range, then the calc returns "0."

How do I get it to evaluate the Paydate field on all the records instead of just the first one?

Please let me know if this doesn't make sense. It's a little difficult to explain.

In DB1, create a calc field that returns the AmtExpected if the PayDate falls within the correct range (BTW, you can use the "If" statement rather than the "Case" statement, since it's only one "if"). Call this field AmtReallyExpected (or whatever).

In DB2, create a calc field:

Sum(AmtReallyExpected).

That oughta do it.

Put your calc in Database 1 instead:

AmtByDate=

Case(PayDate great.gif DateRange1 and PayDate less.gif DateRange2 , AmtExpected)

Then in Database 2, all you need is Sum(NDirectMutualFunds::AmtByDate)

Of course, if your DateRange fields have to be in DB2, it's a little trickier. Are they global fields? If so, you can create a constant relationship to use them in the calc above.

  • Author

Thanks!!!! That did it. I can stop mumbling to myself now. smile.gif

quote:

Originally posted by Fitch:

Put your calc in Database 1 instead

I thought I said that.

"In DB1, create a calc field..."

"I thought I said that."

Looks like our posts crossed while I was pondering the problem. We can't all think as fast as you, Dan. crazy.gif

I used the technique above for a similar task. Now I would like to do it in a relationship (to show a portal). Is there any way of doing that? When I try it says something about the calc field not being indexable..

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.