The grabdata( function grabs the contents of a field in the current record of a database. You can grab data from the current database, or from another database.
Parameters
This function has two parameters:
database – is the database that you want to grab data from. This database must be currently open. If this parameter is ""
or omitted then the current database will be used.
datafield – is the name of the field that you want to retrieve data from. For example if you want to retrieve check numbers, this should be the name of the field that contains check numbers. This must be a field in the database specified by the first parameter.
Description
The function returns the contents of the specified field in the specified database. Unlike lookup( functions, the grabdata( function does not search for the data, it simply uses whatever data is in the currently active record of the specified database.
This example grabs the currently selected item in a Price List database and copies it into the Item and Price fields in the current database (perhaps an invoice).
Item=grabdata("Price List",Part)
Price=grabdata("Price List",Price)
The drawback of the grabdata( function is that the user must manually locate the data, but sometimes this is exactly what you want. You can also use the grabdata( function to grab data the current record, but where you need to calculate the field name on the fly. Suppose you have a database that has four fields for phone numbers: Phone1, Phone2, Phone3, Phone4. Another field, PrimaryPhone, contains a number (1–4) telling which of these phone numbers is the primary phone number. The procedure below will dial the primary phone number.
dial grabdata("Phone"+str(PrimaryPhone))
If the formula calculating the field name is a single field or variable, you must surround it with ( and ). For example, grabdata((Primary))
tells Panorama to grab the contents of the field whose name is in Primary. The formula grabdata(Primary)
, however, tells panorama to grab the contents of the field Primary itself.
Another use for the grabdata( function is to ensure that you are getting a value from a field and not a variable. Normally, if there is a variable with the same name as a field, you won’t be able to access the contents of the field. Use the grabdata( function if you want to make sure you are getting a field value, even if there is a variable of the same name.
select grabdata("Company") contains "acme"
In an application like this, using grabdata( is faster than simply using the variable name (because Panorama doesn’t have to check to see if there is a variable with this name).
See Also
History
Version | Status | Notes |
1.0 | Updated | Carried over from Panorama 6.0, but now allows the first parameter to be omitted (defaults to current database). Also, you can now use fieldvalue( instead of grabdata(, they are the same. |