[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  INDICES           Numerous reported problems.

  Clipper Version  1.03 dtd 09/15/90.

  Problem Statement

  Numerous reported problems re' indices; e.g., SEEK's, SET RELATION TO's
  and PACK's. Numerical indices containing appended blanks are out of
  order. Indexing on a child relation will destroy the child's index.

  Cause

  Unknown.

  Work Around(s)

  Unknown. Suggest use of character type index keys. The following
  function will handle negative numbers and treat blanks as zeros.

  FUNCTION num2str(nNumber)
  RETURN ( PADL(LTRIM(STR(IF(nNumber<0,ABS(1/nNumber),nNumber),;
         LEN(STR(nNumber))+2,LEN(STR(nNumber))-AT(".",STR(nNumber))+2)),;
         LEN(STR(nNumber))+2,IF(nNumber<0,"-","0")) )

  A workaround for indexing on a child's data is to use a UDF. Example:

      SELECT 2
      USE test2 ALIAS S
      INDEX ON key_id TO test2
      SELECT 1
      USE test1 ALIAS P
      INDEX ON RELFUNC(P->key_id) TO test1

      FUNCTION RELFUNC(idkey)
      LOCAL cRetVal
      SELECT 2
      SEEK idkey
      cRetVal = IF( !S->(EOF()), S->last_name+S->first_name,;
                    SPACE(LEN(S->last_name+S->first_name)) )
      SELECT 1
      RETURN cRetVal

  Note:  The index file created by indexing on a number field has a
  different internal representation depending upon whether the file was
  created by Summer '87 or Clipper 5.0.

See Also: MEMORY/VMM PACK SET RELATION
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson