ValueIterator ( )

Function stats

Average user rating
34
165
9999
Support
FileMaker 8.0 +
Date posted
24 December 2008
Version
1
Recursive function
No

Author Info
 The Shadow

22 functions

Average Rating 4.3

author_avatar



 

Function overview

Prototype

ValueIterator  ( values )


Parameters

values  The values to iterate over


Description

Tags:  ValueIterator  

This function creates a value-iterator "object" that can iterate over a list of values. The returned reference is passed into the other value-iterator functions to manipulate it.

The iterator allows moving forward (via NextValue()), backwards (via PrevValue()) and can be reset to the beginning or end at any time.

Since its state is held in a global variable, it is persistent only for a single run of FileMaker, but across scripts and other calculations.

Examples

Sample input

ValueIterator(”ape¶beta¶grape¶jelly¶jam” )


Sample output

$$_tmp1

 

Function code

Let( iterName = "$$" & _tmpVarName;
Evaluate(
"Let( ["
& iterName & "[-1] = " & Quote(iterName) & ";"
& iterName & "[0] = " & Quote(values) & ";"
& iterName & "[1] = 0;"
& iterName & "[2] = " & ValueCount(values)
& "]; "
& Quote(iterName) & " )"
)
)

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/165

    Prototype: ValueIterator( values )
    Function Author: The Shadow (http://www.fmfunctions.com/mid/34)
    Last updated: 24 December 2008
    Version: 1

*/
// ===================================

 

Comments

BruceR
30 December 2008



The iterator functions seem interesting but it would be really great to see an example file to show how they are used.
  General comment
The Shadow
31 December 2008



Bruce, there is now a demo file at:
http://www.spf-15.com/fmExamples/

Download the 'Value Iterators' example and take a look. The value iterator basically holds the state of iteration through a list, so that it can be easily referenced throughout an application. It is persistent thru its use of global variables to provide storage.

Hope that's what you were looking for.
Shawn
  General comment