May 9, 200817 yr 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 May 9, 200817 yr by Guest
May 9, 200817 yr 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
May 9, 200817 yr 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 )
May 9, 200817 yr Author 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.
May 9, 200817 yr 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?
May 9, 200817 yr Author 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 ;-)
May 9, 200817 yr 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?
May 11, 200817 yr Author 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.
May 11, 200817 yr 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
May 11, 200817 yr 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.
May 11, 200817 yr Author I'll consider that and see if it works. Thanks for you input ;-) Edited May 11, 200817 yr by Guest
Create an account or sign in to comment