AnsweredAssumed Answered

VRF-Dynamically_Reprogramming_VEE_Formulas

Question asked by VRFuser on Apr 21, 1998
send q VRF-Dynamically_Reprogramming_VEE_Formulas vrf

from: Greg Goebel / HP-MXD
      gvg@lvld.hp.com / 800-452-4844
      website:  ftp://fcext3.external.hp.com/dist/mxd/index.html
to:   Michael Beckman / VRF
date: Wednesday, 22 April 1998 1152 MDT

Sir:

As per the instructions for the VRF ... please precede your correspondence
with the suffix "VRF-" as with this message.  This is considerate for people
who get a lot of email and need to prioritize it.

That said ... here's a note from the VEE Tutor on the PCTM Website:

--------------------------------- cut here ----------------------------------



[13.9] DYNAMICALLY REPROGRAMMING VEE FORMULA OBJECTS

* A user handed me an example program in which he was trying to extract a
record field with an equation (roughly) of the form:

      +---------------------+
      |       Formula       |
      +-------+-------------+
   -->| Rec   | Rec.Field   +----
   -->| Field |             |
      +-------+-------------+

This would work OK if the input record actually had a field with the precise
name "Field" -- but what he really wanted to do was put an arbitrary field
name like "temp" or "pressure" in on the "Field" pin as a string and get the
"Rec.temp" or "Rec.pressure" field as programmed.

As stated, this couldn't work because the formula above was specifying a
literal name as its first half -- but expected to obtain a value in the second
(the Formula, of course, really just thinks it's a literal name all the way
through, which is reasonable).  However, there is a relatively easy
workaround.

A "Formula" control pin (not a data pin -- a control pin) can be added to a
Formula box (and related objects) that allows the programmer to express a
formula externally as a string and shove it in the pin.  So, to get this to
work, two objects would be needed, as follows:

                                        +-----------------+
   ---------------------------------+   |                 |
                                    |   |      +----------+---------+
       +------------------------+   |   |      |      Formula       |
       |         Formula        |   |   |      +---------+----------+
       +-------+----------------+   +---|----->| Rec     |          +--->
   --->| Field | "Rec." + Field +-------|--+-->| Formula |          |
       +-------+----+-----------+       |  |   +---------+----------+
                    |                   |  |
                    +-------------------+  |   +--------------+
                                           |   | AlphaNumeric |
                                           |   +--------------+
                                           +-->| Rec.pass     |
                                               +--------------+

The first object performs simple string operations to create the formula that
actually to be executed; it shoves the formula into the second object,
which then executes it.

Notice that since "Formula" is a control pin, it's asynchronous -- so to ensure
synchronization the sequence-out pin of the first Formula box is wired to the
sequence-in pin of the second.

This technique has obvious potential for elaboration ... any interesting
variations on it might make for interesting reading.  A sample program is
available in the file xformpin.vee.

[<>]

Outcomes