Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6038 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

Hello,

Can you assist:

I have a CF:

_GetNthRecordSet - (fieldName, recordNumStart, recordNumEnd) =

Let ([

startParam = recordNumStart ;

start = Case ( startParam < 1 ; 1 ; startparam ) ;

end = recordNumEnd ;

thisVal = Case (IsValid ( GetNthRecord ( fieldName ; start ) ) ; GetNthRecord ( fieldName ; start ) ) ; nextStart = start + 1

] ;

thisVal & Case ( IsValid ( GetNthRecord ( fieldName ; nextStart ) ) and ( ( end = "" or end = 0 ) or nextStart <= end ) ; "¶" & _GetNthRecordSet ( fieldName ; nextStart ; end ) ; ))

This works fine on non-repeating fields, BUT I want the result of this CF to calculate in EVERY CELL of a repeating field. Every combination of the Extend() function I have tried fails.

Any ideas?

Edited by Guest
Posted

Every combination of the Extend() function I have tried fails.

It should be in each of the paramters when calling the CF, have this been tried as well??

--sd

Posted

I don't see how Extend() would help here - this function is intended to be used on non-repeating fields. Normally, you would use List ( RepeatingField) to get all repetitions. However, the construct GetNthRecord ( List ( RepeatingField ; ... ) ) won't work, because GetNthRecord() requires a field name, i.e. a reference, not a value.

I think you could do one of two things: either precalculate the contents of the repeating field into a field using the List() function, then use your custom function on this field, or have your custom function do an inner loop on the repetitions. GetNthRecord will accept a reference using a variable, so you can loop using something like:

GetNthRecord ( RepeatingField[j] ; i )

Posted

You are correct Soren ;-)

The KEY is to use the Extend() on the field and leave everything else as is:

_GetNthRecordSet - (Extend(fieldName), recordNumStart, recordNumEnd)

Thanks! This gets me the result needed.

Posted

I thought you wanted the function to return all repetitions of a repeating field across a found/related set. Now I understand you wanted it to summarize a non-repeating field - but to use the function IN a repeating calculation field. The above should work for this purpose - but what's the point of using both a custom function AND a repeating calculation field?

Posted

I'll explain but I think I might lose you;-) It is for an appointment system I am building.

I have a repeating field (30 reps) which has sequential times (8:00:00, 8:15:00, 8:30:00, etc...)

I have a relationship to appts which also have a time range. An appt from 8:00:00 - 9:00:00 would generate a KEY field like the following:

8:00:00

8:05:00

8:10:00

8:15:00

8:20:00

8:25:00

8:30:00

8:35:00

8:40:00

8:45:00

8:50:00

8:55:00

I then pull my relational data via the CF which gives me a COMPLETE LIST of times being used for all my relate appts.

This is calculated in a rep field (30) - the list in EACH rep.

Then I have yet another rep field (30) which then compares to see if the time is in the LIST. If it is, it displays a graphic (shades it in) ELSE it is null (Blank)

To add more complexity, I have another field scheme which I use to extract what color to use for the shading.

Although the code is quite involved, it all is working well and the performance is decent.

Thanks everyone for your feedback ;-)

Posted

I don't know whether you've lost me or not: it seems to me your repeating calculation field (the one that uses the CF) returns the SAME result for each one of its 30 repetitions?

Posted

Right. Exactly what I need...the same list in ALL the reps so I can check each value of the sequential time to see if it exists in the duplicated list,

If is does, I shade it in ELSE leave it null. It works pretty slick.

Posted

Are we likely to expect it to arrive eventually on your site as well? I'm still scratching myself nearly ready to buy a toupee ...as to what on earth is going on here - mind you baldness isn't running in my family!

--sd

Posted

I believe it would be more efficient to calculate the list ONCE, i.e. in a NON-REPEATING calculation field. Then, when you check whether a specific value appears in the calculated list, you would refer to it as Extend ( calculatedList ).

That is assuming the list even needs a field on its own. After all, the list could be defined as a variable in the subsequent calculation field.

Posted (edited)

I'll consider that and see if it works. Thanks for you input ;-)

Edited by Guest

This topic is 6038 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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