SP_SMALLWHEN

SMALLWHEN()

  Short:
  ------
  SMALLWHEN() Uses SMALLS() in a WHEN condition for a GET

  Returns:
  --------
  lValid  => logical value

  Syntax:
  -------
  SMALLWHEN([lShowOnUp],[lReturn],expDisplayString,[cTitle],;
       [expAlias],expReturn,[expStartRange,expEndRange],[bException])

  Description:
  ------------
  Uses SMALLS() in a WHEN condition for a GET. See
  SMALLS() for description of parameters <expDisplayString>
  through [bException]

  [lShowOnUp] If False (the default), smalls is not
  called when going backwards through the read (up arrow, etc), only when
  going forward.

  [lReturn]   This is simply the value to return. The
  default is False, which means the get is never 'edited'. A value
  of True means the smalls() lookup is done, and then the get is edited.

  Examples:
  ---------
   @3,0 GET V3 WHEN ;
       SMALLWHEN(.f.,.f.,"LASTNAME",nil,5,"LASTNAME")

   // This will pop up a smalls() lookup table when going forward
   // through the gets. If RETURN is pressed, the current GET is fed
   // or assigned the lookup value. (depends on value of <expReturn>)
   // A False is returned, so the GET is not actually edited. The new
   // value is displayed, and the next get is made active.

  Notes:
  -------
  See Smalls() for a complete parameter description.

  Source:
  -------
  S_SMGETS.PRG

 

Advertisements

SP_SMALLVALID

SMALLVALID()

  Short:
  ------
  SMALLVALID() Uses SMALLS() lookups in a VALID condition for a GET

  Returns:
  --------
  lValid  => logical value

  Syntax:
  -------
  SMALLVALID([bValid],expDisplayString,[cTitle],;
     [expAlias],expReturn,[expStartRange,expEndRange],[bException])

  Description:
  ------------
  Uses SMALLS() in a VALID condition for a GET. See
  SMALLS() for description of parameters <expDisplayString>
  through [bException]

  If the user selects a value from the SMALLS() lookup,
  a value of True is returned, allowing the next GET to be made
  active. Otherwise, a False is returned. The return value is also
  determined by [bValid]

  [bValid]  -  This is a code block that determines if
  the current get is already valid. If this is passed, it is first
  evaluated, and, only if the current get is NOT ALREADY VALID,
  SMALLS() is called with the SMALLS() parameters given. If this
  is not passed, SMALLS() is called automatically. IF this is
  passed and the GET is valid, a True is returned, allowing the
  next GET to be 'gotten'.

  Examples:
  ---------
   @3,0 GET V3 VALID  ;
       SMALLVALID({||!EMPTY(V3)},"LASTNAME",nil,5,"LASTNAME")

   // This will pop up a smalls() lookup table when attempting to exit
   // the get 'V3' where 'V3' is empty. A SMALLS() lookup is  called, with
   // smalls() parameters provided, and, if CR is pressed, the GET is fed
   // or assigned the lookup value. (depends on value of <expReturn>)
   // If 'V3' is already valid, a True is returned, and the next GET is made
   // active. If SMALLS() is called and CR is pressed while in SMALLS(),
   // a True is returned. Otherwise a False is returned.

  Notes:
  -------
  See Smalls() for a complete parameter description.

  Source:
  -------
  S_SMGETS.PRG

SP_SMALLS

SMALLS()

  Short:
  ------
  SMALLS() Lookup tables on dbf with optional hotkeys, code block

  Returns:
  --------
  lReturn   => True if CR pressed, False otherwise

  Syntax:
  -------
  Smalls(expDisplayString,[cTitle],[expAlias],[expReturn],;
      [expStartRange,expEndRange],[bException],[lForceCaps])

  Description:
  ------------
  Popup windowed lookup tables. Many options.

  The up/down/home/end/pgup/pgdn keys are active. If
  there is an controlling index key and the user types alphanumeric
  characters, it is assumed a keysearch is wanted. A read pops up
  allowing the user to complete the search key, and a seek is then
  done.

  Pressing ENTER or ESCAPE exits the lookup and closes
  the window.

  Depending on values contained in the optional
  parameters, values may be KEYBOARDED or ASSIGNED at that time.

  Other keys may be assigned actions, depending on the
  last parameter, described below.

  <expDisplayString>  is what appears for each row in
     the lookup table.

     Think of it as a column definition for Tbrowse.
       It can be either:

       1. A Characters string like
          "LAST+MI+LEFT(FIRST,1)"
          In which case it is macro expanded and made
          into a code block to display this expression

       2. A Codeblock like
          {||LAST+MI+LEFT(FIRST,1)}

       The resulting codeblock is then used as a
       Tbrowse column definition.

  [cTitle]    is an optional lookup box title string

  [expAlias]  Determines the area/dbf/ntx to use, can be
     (expC) alias name             or
     (expN) numeric work area      or
     (expC) dbf/ndx in the format
            "%dbfname%ndxname"

     If left as nil, the current DBF/NTX are
     used and left open when done at the last record
     pointer position.

  [expReturn] This determines what happens when CR is
     pressed. It need not be anything, but it can be:

     (expC) a character expression which is
            macro expanded and KEYBOARDed. Any valid character
            expression will do.

            (Bear in mind that it must be
              character. If you want to keyboard a value into a DATE
              field, for instance, your keyboard expression could be
              "DTOC(entrydate)"

     (expB) a code block which is simply
            evaluated. this can do
            anything you wish. It could assign
            multiple values
            from the lookup file into active
            gets, for instance.

  [expStartRange-expEndRange]
     These are valid for indexed files, and
     determine the beginning and ending key ranges. The
     values must match the type of the controlling index.

  [bException]
     If this codeblock is passed, any keys
     except up/down/enter/pgup/pgdn/home/end/escape  (and
     alphanumeric keys if indexed )  will cause the block to be
     evaluated like so:

       eval(block,lastkey())

     Some interesting ideas for this would be
     to assign a key to an update routine for updating the
     lookup dbf while doing a lookup. (yikes - you didn't hear
     that from me!)

  [lForceCaps]

     Means force capital letters when user is typing in a
     lookup key.  Allows case-insensitive search when index is on
     upper(field)

  Examples:
  ---------
   // lookup on "LNAME+' '+FNAME" in current area
   smalls("LNAME+' '+FNAME")

   // lookup on "LNAME+' '+FNAME" in current area
   // use "Name" as box title
   smalls("LNAME+' '+FNAME","Name")

   // lookup on "LNAME+' '+FNAME" in current area
   // use "Name" as box title
   // go to area 5 for the lookup
   // send LNAME to the keyboard if CR pressed
   smalls({||LNAME+''+FNAME},"Name",5,"LNAME")

   // lookup on "LNAME+' '+FNAME" in current area
   // use "Name" as box title
   // go to alias CUSTOMER for the lookup
   smalls("LNAME+''+FNAME","Name","CUSTOMER")

   // open customer.dbf and do a lookup on it
   // lookup on "LNAME+' '+FNAME"
   // use "Name" as box title
   smalls("LNAME+''+FNAME","Name","%CUSTOMER")

   // open customer.dbf and do a lookup on it
   // lookup on "LNAME+' '+FNAME"
   // use "Name" as box title
   // limit lookup to between "SMITH" and "ZEBRA"
   smalls("LNAME+''+FNAME","Name","%CUSTOMER%NAME",  ;
         "SMITH","ZEBRA")

   // open CUSTOMER.DBF with ENTRYDATE.NDX and do a lookup
   // lookup on "LNAME+' '+FNAME"
   // use "Name" as box title
   // limit lookup to the last year
   smalls("LNAME+''+FNAME","Name",  ;
         "%CUSTOMER%ENTRYDATE",date()365, date())

  Notes:
  -------
  see SMALLVALID(), SMALLWHEN() and SMALLKSET() for
  various get system interfaces to SMALLS().

  Source:
  -------
  S_SMAL.PRG

 

SP_SEARCHMRS

SEARCHMRS()

  Short:
  ------
  SEARCHMRS() Resets all SEARCHME() settings

  Returns:
  --------
  NIL

  Syntax:
  -------
  SEARCHMRS([)

  Description:
  ------------
  Resets all SEARCHME() static variables
    - sets found() flag to FALSE
    - sets locate block to nil
    - sets continue flag to .f.
    - sets ALIAS to nil

  For instance, if you change datafiles - you need to reset
  SEARCHME() with SEARMRS()

  Examples:
  ---------
  SEARCHMRS()

  Source:
  -------
  S_SEARCH.PRG

 

SP_SEARCHMFND

SEARCHMFND()

  Short:
  ------
  SEARCHMFND() Set/return last found() status from SEARCHME()

  Returns:
  --------
  <lFound> -> Last searchme found() status

  Syntax:
  -------
  SEARCHMFND([lSet])

  Description:
  ------------
  Sets/retrieves the last found() setting for SEARCHME()
  [lSet] optionally sets the found() flag.

  For instance, to find out what the last result of SEARCHME() was
  so you can take an action or not based on something being found,
  use SEARCHMFND() to retrieve the last result.

  Examples:
  ---------
  SEARCHMFND(.f.)

  Source:
  -------
  S_SEARCH.PRG

 

SP_SEARCHME

SEARCHME()

  Short:
  ------
  SEARCHME() Search a DBF with user-specified criteria

  Returns:
  --------
  <bSearch> -> The code block used to do the search

  Syntax:
  -------
  SEARCHME([aField,aFieldTypes,aFieldLengths],[aFieldDesc])

  Description:
  ------------
  Searches the current dbf with criteria given

  by the user.

       for :    Field Contents Match
                Query match  --->> calls QUERY()
                End of file
                Beginning of File
                Deleted Records
                Memo contents

  On subsequent calls, if the previous search resulted
  in a FOUND(), a box asking "Continue..", "New Search" will pop up.
  If CONTINUE is selected, a continuation of the last search is
  done.

  Three arrays may be passed for FIELDS [aFields],
  FIELD TYPES [aFieldTypes], and FIELD LENGTHS [aFieldLengths].

  An additional (optional) array of field descriptions may be passed

  Default is all fields, field names as descriptions.

  Searchme() actually returns the code block used to do the
  search. Normally you would want to ignore this. I use it in
  TAGIT() - if the code block is not NIL, then I can 'tag all
  matching' with it.

  Examples:
  ---------
  SEARCHME()

  Source:
  -------
  S_SEARCH.PRG

 

SP_GENVAL

GENVAL()

  Short:
  ------
  GENVAL() Generic VALID clause validation with message

  Returns:
  --------
  <lValid> => logical result of passed condition

  Syntax:
  -------
  GENVAL(expValid,expMessage)

  Description:
  ------------
  Evaluates <expValid>, which is either a bode block or
  a string to be macro expanded, as a logical value. If result is
  False, displays message <expMessage> and waits for a keypress.
  <expMessage> can be a single string, or an array of strings (see
  aMsg() ).

  Examples:
  ---------
   if genval("fcount() < 60",'Too many fields')
       COPY TO TEMP
   endif

   * ...or as a VALID CLAUSE macro'd

   @10,10 get lname VALID ;
     GENVAL("!empty(lname)","Need a last name")

   * ...or as a VALID CLAUSE eval'd

   @10,10 get fname VALID ;
     GENVAL( { || !empty(fname) },"Need a last name")

  Source:
  -------
  S_GENVA.PRG