VIEWPORT() Multi-optional data entry engine



  Presents a generic data entry screen with multiple
  movement, search, view and editing capabilities.

  [lModify] Logical - this is (.T.) if you want to give
  the user Add,Edit,Delete, and (.F.) if not. Defaults to (.T.)

  Arrays 1-5 and array 7 must have the same # of
  (default is # of fields in DBF). You may pass a nil
  to bypass and activate the default for any of these arrays.

  [aFields]    An array of field names. Defaults to all
  fields in DBF.

  [aDesc]   An array of field descriptions. Defaults to
  field names. You must pass [aFields] if you wish to pass

  [aPict]  is an array of PICTURES as Character
  expressions to correspond with the [aFields] array. Default is
  pictures as derived by ED_G_PIC(). If you pass this array,
  each element must contain  at least a "".

  [aVal] is an array of VALID clauses and messages
  to correspond with the [aFields] array. Each is in the form

         "{valid clause};{valid message}"

  The FIELD is represented as a token "@@"
  in the valid clause which is replaced with the current edited
  value at edit time. Note: Field values are loaded into an
  array when editing, so field names in the valid are not
  meaningful. Field name FIRST might be aValues[12]. At edit
  time, the "@@ " will be  replaced with "aValues[12]".

          "!empty(@@);Must not be empty"

  If you pass this array, each element must
  contain at least a "".

  [aLook]  is an array of Lookup definitions
  corresponding to the [aFields] array.
  These are delimited strings with 1-4
  component parts matching the first four parameters of SMALLS().
  Delimiter is a semicolon (;). As an example, to make a lookup
  definition corresponding to the COMPANY field in the
  [aFields] array, which will lookup on the field CORPNAME in
  the database INSTIT, titling the box "Company" and KEYBOARDing
  the contents of CORPNAME if CR pressed


  If you realize that these 4 components are
  parsed and sent as parameters to SMALLS(), you will get the

  If you pass this array, each element must
  contain at least a "".

  [aOther]  [1-9 elements] Each of elements 1-9 is a
  delimited string in the format


  where option is a displayed menu option and action
  is a proc to be executed. i.e.:

          "Form Letters;FORMLETR()"
          "List Myfile;FILEREAD(2,2,22,78,'FMYFILE.TXT')"

  Pass 1-9 option/proc combinations. These
  will be presented as an 'Other' menu.


  [aEdit] an array of logicals matches the FIELDS
  array and defines which fields may be edited (.t.) and which
  are display only (.f.)  If you pass this array, each element
  must be of TYPE Logical.

  [lCarry]     Pop up 'Carry Forward' message when adding?
  True/False. Default is True.

  [cTitle]     Optional title. Default is
               "  V.I.E.W  P.O.R.T  for file: "+TRIM(ALIAS())+' '

   local aFlds[fcount()]
   local aFdes[fcount()]
   local aFval[fcount()]
   local aFloo[fcount()]
   local aFedit[fcount()]

   // valids for fields 5 and 6
   aFval[5]:="!empty(@@);Cannot be empty"
   aFval[6]:="!empty(@@);Cannot be empty"

   // lookups for fields 5 and 6
   aFloo[5] := "First;First Name;%user%;trim(first)"
   aFloo[6] := "Last;Last Name;%user%;trim(Last)"

   // 'other' menu array

   aOther := { "Read PRG;FILEREAD(1,1,23,79,'s_viewp.prg')",;
               "Do Form Letters ;FORMLETR()",;
               "Frequency Analysis;FREQANAL()" }



2 responses to “SP_VIEWPORT

  1. Pingback: SP Metafunction | Viva Clipper !

  2. Pingback: SP Functions | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.