$FieldgroupOccurrence: Difference between revisions
No edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
This function returns the current occurrence number of the field group. | |||
If the current field group has been deleted, <var>$FIELDGROUPOCCURRENCE</var> returns 0. | |||
<var>$FIELDGROUPOCCURRENCE</var> is available as of Model 204 version 7.5. | |||
==Syntax== | |||
<p class="code"> | <p class="syntax"><span class="term">%num</span> = <span class="literal">$FIELDGROUPOCCURRENCE</span> | ||
FOR EACH OCCURRENCE OF FIELDGROUP REDSOX | </p> | ||
==Example== | |||
<p class="code">FOR EACH OCCURRENCE OF FIELDGROUP REDSOX | |||
PRINT $FIELDGROUPOCCURRENCE | PRINT $FIELDGROUPOCCURRENCE | ||
CALL CHANGINGPROC | CALL CHANGINGPROC | ||
Line 11: | Line 15: | ||
END FOR | END FOR | ||
</p> | </p> | ||
This example might print a different value before and after the CHANGINGPROC if | This example might print a different value before and after calling the CHANGINGPROC procedure, if that procedure inserted or deleted the field group occurrence before the current one. | ||
$FIELDGROUPOCCURRENCE | ==Usage notes== | ||
<ul> | |||
<li>In a large record, $FIELDGROUPOCCURRENCE is expensive. It intentionally scans from the start of the record, in case there were additions or deletions of the fieldgroup. | |||
<p> | |||
For example, say that a record being processed in an <var>FEO FIELDGROUP</var> loop has thousands of occurrences of a fieldgroup named <code>CORE</code>. In this case, invoking <var>$FIELDGROUPOCCURRENCE</var> for each iteration of the loop will be prohibitively expensive, and you can save significant processing resources if you substitute a simple <code>OCCURRENCE IN CORE</code> statement for the <var>$FIELDGROUPOCCURRENCE</var> statement. </p> | |||
</ul> | |||
[[Category:SOUL $functions]] | [[Category:SOUL $functions]] |
Revision as of 22:14, 12 December 2013
This function returns the current occurrence number of the field group. If the current field group has been deleted, $FIELDGROUPOCCURRENCE returns 0.
$FIELDGROUPOCCURRENCE is available as of Model 204 version 7.5.
Syntax
%num = $FIELDGROUPOCCURRENCE
Example
FOR EACH OCCURRENCE OF FIELDGROUP REDSOX PRINT $FIELDGROUPOCCURRENCE CALL CHANGINGPROC PRINT $FIELDGROUPOCCURRENCE END FOR
This example might print a different value before and after calling the CHANGINGPROC procedure, if that procedure inserted or deleted the field group occurrence before the current one.
Usage notes
- In a large record, $FIELDGROUPOCCURRENCE is expensive. It intentionally scans from the start of the record, in case there were additions or deletions of the fieldgroup.
For example, say that a record being processed in an FEO FIELDGROUP loop has thousands of occurrences of a fieldgroup named
CORE
. In this case, invoking $FIELDGROUPOCCURRENCE for each iteration of the loop will be prohibitively expensive, and you can save significant processing resources if you substitute a simpleOCCURRENCE IN CORE
statement for the $FIELDGROUPOCCURRENCE statement.