live lookups?
David Thompson
dthmpsn1 at illinois.edu
Mon Jul 14 18:12:34 PDT 2008
>I am using the following code to track agents for our clients:
>lookup(info("databasename"),RPID,RPIDAgent,NameFull,"No Agent Assigned",0)
>
>It works just fine. The "RPID" is a numeric code to reference our
>clients in the database. Most clients have an agent, also in the
>database. By entering the RPID for their agent in the field with
>this calculation, Panorama looks up the Agent's name for the viewer.
>Here's my question, though. If an agent changes their name (one just
>got married), this field does not seem to automatically update for
>all of their clients. Is there a simple way to update changes like
>this across the database?
As Bruce said, the way to do live lookups is to put the formula into
the form, so that the lookup is done every time the form is opened or
refreshed. To update the records themselves, you need to run a
procedure. If the database is set to use Procedure Style Formulas,
rather than Spreadsheet Style formulas (chosen from the "Special"
menu in the design sheet), then you can set it to trigger a procedure
when an entry is made in the NameFull field. The procedure would look
something like this.
Local vRPID, vNameFull
vRPID = RPID
vNameFull = NameFull
Field Agent
FormulaFill ?(RPIDAgent=vRPID, vNameFull,Agent)
See the section on Automatic Calculations on page 306 of the Panorama
Handbook for the differences between Procedure Style and Spreadsheet
Style formulas.
In the example above, "Agent" is meant to be the name of the field
that receives the result of that lookup. You would need to substitute
the actual name of that field for the name I used.
Since agents don't change their names every day, it might be overkill
to have the procedure run automatically. You may just want to trigger
it from the Action menu as needed.
Dave
More information about the Qna
mailing list