Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Repeating Calculations


aelewis
 Share

Recommended Posts

Hello,

Since you're all experts :) I'll just jump right in to my problem.

I have two tables, in which 1-4 records in the second are related to exactly 1 record in the first. I have a calculation field of 4 repetitions in the first table. I want the calculation to display the data from an ID field in the second table for the 1-4 related records in its 1-4 repetitions. I cannot portal this as the data i want displayed in the repeating field in the first table is BASED on the ID field in the second table--the data is not identical.

I cannot seem to get the repeating calculation field to calculate for more than only the first repetition. However, it calculates that first repetition correctly. If i remove the edit portion of my formula and have it only copy exact data from the second table, I am faced with the same problem.

Here is my (simple) formula:

GetNthRecord ( Recipients::Ear Mark ; Get ( CalculationRepetitionNumber ) )

This calculates for the first repetition the correct data. If i change the second parameter to: Get ( CalculationRepetitionNumber ) + 1, then it correctly calculates the data that belongs in the second repetition to the first.

How can I make it run the calculation for all repetitions?

Thanks in advance for your help. I have learned much from reading answers to other people's questions already...

Link to comment
Share on other sites

I did not understand why you cannot show this in a portal. In any case, the problem you are having with the calculation can be solved by using Extend() - as is always the case when referencing a non-repeating field in a repeating field calculation:

 

GetNthRecord ( Extend ( Recipients::Ear Mark ) ; Get (CalculationRepetitionNumber) )

Link to comment
Share on other sites

Thank you so much! I had tried many variations of using the Extend function, as I know this is what you use, but nothing seemed to work. I guess I didn't try it the exact way you wrote it.

If my formula were as simple as the example, I'd absolutely have just used a portal. However, I will now be adding more to the formula so that it will enter a certain code based on the 'syntax' of the ID field in the related records.

Thanks again!

Link to comment
Share on other sites

OK new question :) but it is regarding the exact same situation.

There is another piece of data given in the second table (a date of birth), and I want in my repeating field on the first table for it to display the calculated age at the time of the procedure (the procedure date is recorded on the first table). Please see my formula:

Let (

i = GetNthRecord ( Extend ( Recipients::Rec DOB ) ; Get ( CalculationRepetitionNumber ) ) ;

If ( i = "?" ; "" ; Transfer Date - i )

)

This calculates for the first repetition correctly, and fails to correctly calculate any further repetitions where a date of birth is available.

Help again?

Link to comment
Share on other sites

Yes, it seems to be the same situation, and the answer is also the same: wrap any referenced non-repeating field with Extend().

 

I still don't see the problem with using a portal. GetNthRecord() is not the quickest function, and you're making this more complicated than it needs to be, IMHO. The calculation can be just as easily made in the child table. I have no idea what you mean by "the 'syntax' of the ID field in the related records". If the relationship works, you can see the related records in a portal. If it doesn't, your repeating calc won't work either.

Link to comment
Share on other sites

 Share



×
×
  • Create New...

Important Information

Terms of Use