The field statement tells Panorama to move to the specified field for the current record.
This statement has one parameter:
fieldname – can be a literal field name, a quoted string, field, variable, or formula that returns the name of a valid field for the active database. This field name is case sensitive and must match the field names as they were established in the database. If the field name is two or more words it must be enclosed in chevron characters to be recognized as a valid field name. Note: If fieldname is a field or variable which contains the name of the field you wish to move to you must enclose it inside parentheses so that Panorama treats fieldname as a formula and not a literal value.
This statement moves Panorama’s cursor to the field indicated by fieldname for the currently active record.
Note: If fieldname does not match a valid field for the active database Panorama will return an error alert.
This simple example tells Panorama to go to the Address field.
This example assumes a database that has a field for each day of the week: Sunday, Monday, etc. The following procedure will place the cursor on the field matching the current day. To distinguish FieldName as a formula it must be enclosed inside parenthesis ( ) characters.
local theFieldName theFieldName = datepattern(today(),"Day") field (theFieldName)
This example goes from line item field Price 1 to Price 10 blanking out the fields as it goes along.
local TheCount TheCount = 0 loop TheCount = TheCount +1 field "Price "+str(TheCount) clearcell until TheCount = 10
Note: The field statement also allows the target field to be specified numerically (from 1 to the maximum number of fields in the database). For example, this statement moves to the leftmost field in the database, without having to know its name:
For this to work, the value must be a number. This example moves to the field named 1, which may or may not be the first field (assuming it exists at all – we wouldn’t recommend giving a field a name like this).
Using a field number in a variable is a bit tricky. You might think that this example would move to the 4th field:
local fn fn=4 field fn
However, that’s not what it does – it actually tries to move to a field named fn. To force Panorama to recognize that this is a number and not a field name you need to use a formula with two or more terms, like this:
local fn fn=4 field fn+0
Here is an example that shows how to create a procedure that scans every field in the database from left to right, performing some operation on each field.
for fn,1,info("fieldcount") field fn+0 // DO SOMETHING FOR EACH FIELD endloop
Field NAME does not exist in database NAME – The requested field does not exist in the current database.
|10.0||Updated||Carried over from Panorama 6.0, but now also allows the field to be specified numerically.|