Database Reference
In-Depth Information
Figure 16-4. Working through any tough calculation is much easier when you use the Data Viewer
instead of creating a calculation field. The Data Viewer has the same context as the record that's
active when you open the viewer. Here the step 1 calc is working on the data in the Values field.
The second instance of the value “red” is removed from the calculation's result. Use fully qualified
field names in its expressions. This one changes that to a parameter when you write the custom
function later in the process.
Now you're ready to move on to the rest of the function, where you call the same action over
and over again—and things start to get interesting.
Step 2: Assume Your Function Already Works, and Use It
You're ready to take the
recursion leap of faith
. A recursive function, by definition, calls it-
self. So at some point, it depends on its own resources to work. But when you're
writing
the
recursive custom function, it obviously doesn't work yet. You'll be at a total impasse if you
don't
assume
it already works, and just get on with writing.
So since you're writing a new custom function called
RemoveDuplicates()
, write its syntax
ure 16-5
). If such a function did exist, you could use it in the above calculation like this:
LeftValues ( values ; 1 ) & RemoveDuplicates ( Substitute ( values ;
LeftValues ( values ; 1 ); "" ) )