SP_ISVALFILE

ISVALFILE()

  Short:
  ------
  ISVALFILE() Checks a file name for validity

  Returns:
  --------
  <lValid> => is file name a valid dos file name

  Syntax:
  -------
  ISVALFILE(cName,[lCheckDup],[@cMessage])

  Description:
  ------------
  Checks the proposed file name in <cName> for
  adherance to the dos file naming conventions.

  [lCheckDup] will check for existance of the file if
  True. Default False.

  [@cMessage] a string passed by reference. The reason
  for rejection will be placed in the string. Messages returned
  are:

    "File name is empty"
    "Duplicate file exists"
    "File name is too long"
    "Too many periods"
    "Too many characters after the period"
    "Too many characters before the period"
    "Too many characters with no period"
    "Invalid character: " (character)
    "Illegal file name"

  Examples:
  ---------

   cFn := space(15)

   while .t.
     cMessage := ""
     @10,10 get cFn
     read
     @20,10 say iif(isvalfile(cFn,.t.,@cMessage),"Valid  ","Not Valid")
     @21,10 say padr(cMessage,50)
   end

  Source:
  -------
  S_ISVALF.PRG

 

C5_IF ( Function )

 IF()
 Return the result of an expression based on a condition
------------------------------------------------------------------------------
 Syntax

     IF(<lCondition>, <expTrue>, <expFalse>) --> Value

 Arguments

     <lCondition> is a logical expression to be evaluated.

     <expTrue> is the value, a condition-expression, of any data type,
     returned if <lCondition> is true (.T.).

     <expFalse> is the value, of any date type, returned if <lCondition>
     is false (.F.).  This argument need not be the same data type as
     <expTrue>.

 Returns

     IF() returns the evaluation of <expTrue> if <lCondition> evaluates to
     true (.T.) and <expFalse> if it evaluates to false (.F.).  The value
     returned is the data type of the valid condition-expression.

 Description

     IF() is a logical conversion function.  It is one of the most powerful
     and versatile functions in Clipper.  It provides a mechanism to
     evaluate a condition within an expression.  With this ability you can
     convert a logical expression to another data type.

 Examples

     .  This example converts a logical data value to a numeric data
        value:

        lPaid = .T.
        ? IF(lPaid, 1, 0)               // Result: 1

     .  In this example a logical field is formatted depending on
        whether the Customer is past due or not:

        @ ROW() + 1, 25 SAY IF(lPaid, SPACE(10), "Go get 'em")

     .  If you are printing forms, you can print an indicating symbol
        in different columns depending on the value of a logical field:

        @ ROW(), IF(InHospital, 10, 12) SAY "X"

     .  You can also use IF() to force the LABEL FORM to print blank
        lines.  Enter the following expression when you create the label with
        RL.EXE:

        IF(EMPTY(Company), CHR(255), Company)

 Files   Library is CLIPPER.LIB.

Note : IF() is synonymous (shorthand)  of IIF().

See Also: DO CASE IF() IIF()