Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community

List_... commands ? (OpenInsight Specific)

At 14 DEC 1997 07:37:48PM Peter Richards wrote:

Running the List_ command set from the System Editor works fine, but executing these commands programatically doesn't seem possible.

There have been many instances of wanting to do a "List_Dict" or "List_Index" within an event/procedure. I have checked out what is already posted and using the RECEIVER property is not always suitable either.

To find out all the table/column names with indexes, retrieving @TABLES, look for those beginning with "!" (exclude !SYSREPOSLOCKS), then retrieving the "*INDEXES row, seems a waste of code, but there doesn't appear to be a shortcut.

Tried the following:

Retval=Utility("RUNWIN","DWB.EXE /UN=username /PW=pwd 'Run List_Index' ")

but obviously it was a futile attempt, and would no doubt need the correct command line parameter in front of the 'Run List_Index', to alt least make a decent attempt to get System Editor to return the values.

Do Revsoft have any plans to make these 'List_…' command set available programatically, or does anyone know how to force System Editor to return the values via the RUNWIN command ?

Peter


At 15 DEC 1997 12:18PM John Duquette wrote:

Peter,

Why is the RECEIVER property not suitable?

John Revelation


At 15 DEC 1997 06:37PM Peter Richards wrote:

John,

My understanding is limited, but from what I have read, I need to create an edit box if the Set_Property is used, so in effect an extra (albeit invisible if required) edit box on every form where I want to use any of the 'List_..' command set.

Or am I making it too complex ? The application runs from a menu (MDI) , so I guess I just have to allocate an extra edit box on the main menu just for these types of retrievals, and all the child forms use the parent edit box ? Hmmm, thanks !

(It would be *real* nice though, to be able to retrieve the results from the 'List_' commands to a variable.)

Thanks again,

Peter


At 16 DEC 1997 03:23AM Peter Richards wrote:

John,

Have tested all the 'List_' routines with the use of the RECEIVER property. They all work fine, however List_Index is not returning all the required information.

The commands:

(Set_Property to set editbox as the receiver of data)

Call List_Index(,,) (Get_Property to retrieve editbox TEXT) returns only the indexed tablenames; no column names or index type information is returned. Even: Call List_Index('EMPLOYEES',,'')

will not return the COLUMN_NAME or index information. I am running OI 3.2

Peter


At 16 DEC 1997 07:46AM Cameron Revelation wrote:

Peter,

I have posted a function below that has the functionality from List_Index. I think this is what you are looking for.

Cameron Purdy

[email protected]

<code>
function Get_Index(pTableNameList, pColumnNameList, pIndexTypeList)

*****************************************************************************
*
* Name       :  Get_Index()
* Description:  Returns a list of indexes.
*
* Arguments:
*   pTableNameList  - The name of the table to return indexing information about
*   pColumnNameList - Specific columns to get indexing information about
*   pIndexTypeList  - A list of index types (1, 2, 3) to return
*
* Result structure:
*    Table Name
*    Column Name
*    Btree Flag
*    Crossref Flag
*    Relational Flag
*
* History (Date, Initials, Notes)
*   12/16/97  cp   Original programmer, based on List_Index
*
*****************************************************************************

declare subroutine Set_Status, V119

$insert Dict_Equates
$insert FSErrors_Hdr
$insert Logical


******
* main
******
  Ret="
  Set_Status(FALSE$)

 * check parameters
  if assigned(pTableNameList) then
    TableNameList=pTableNameList
    convert @lower_case to @upper_case in TableNameList
  end else
    TableNameList="
  end

  if assigned(pColumnNameList) then
    ColumnNameList=pColumnNameList
    convert @lower_case to @upper_case in ColumnNameList
  end else
    ColumnNameList="
  end

  if assigned(pIndexTypeList) then
    IndexTypeList=pIndexTypeList
  end else
    IndexTypeList="
  end

 * apply parameter defaults
  if len(TableNameList) else
   * default to all index tables
    TableNameList="
    cTables=count(@tables, @fm) + (@tables # "")
    for iTable=1 to cTables
      Table=@tables
      if Table 1,1=!" then
        TableNameList := Table 2,99999: @rm
      end
    next i

   * sort list
    V119("S", "", "A", "L", TableNameList, "")
    convert @rm to @fm in TableNameList
    TableNameList -1,1="
  end

  if len(IndexTypeList) else
   * default to return all index types
    IndexTypeList=123"
  end

 *
  bErr=FALSE$
  cTables=count(TableNameList, @fm) + (TableNameList # "")
  for iTable=1 to cTables
    TableName=TableNameList
    DictName =DICT.": TableName
    open DictName to fDict then
     * get a list of column names to check
      if len(pColumnNameList) else
        readv ColumnNameList from fDict, "%FIELDS%", 3 then
          convert @vm to @fm in ColumnNameList
        end else
          ColumnNameList="
        end
      end

     * check each column for indexes
      cColumns=count(ColumnNameList, @fm) + (ColumnNameList # "")
      for iColumn=1 to cColumns
        ColumnName=ColumnNameList
        if len(ColumnName) and ColumnName 1,1 # "%" then
          read Record from fDict, ColumnName then
            if Record=F" or Record=S" then
              bIndexed="
              BTree =FALSE$
              bXRef =FALSE$
              bRelIx=FALSE$
              
              if index(IndexTypeList, 1, 1) then
                if Record then
                  bIndexed =TRUE$
                  bBTree   =TRUE$
                end
              end
              if index(IndexTypeList, 2, 1) then
                if len(Record) then
                  bIndexed =TRUE$
                  bXRef    =TRUE$
                end
              end
              if index(IndexTypeList, 3, 1) then
                if len(Record) then
                  bIndexed =TRUE$
                  bRelIx   =TRUE$
                end
              end
              if bIndexed then
                Ret=TableName
                Ret=ColumnName
                Ret=bBTree
                Ret=bXRef
                Ret=bRelIx
              end
            end
          end
        end
      next iColumn
    end else
      [email protected]
      convert @vm to @fm in ErrArgs
      Set_Status(-1, FS_PREFIX$: @file.error, ErrArgs)
      bErr=TRUE$
    end
  next iTable

  if bErr else 
    Set_Status(FALSE$)
  end   
return Ret

</code>


At 16 DEC 1997 06:03PM Peter Richards wrote:

Cameron,

Thank you, have a great Christmas !!

Peter

View this thread on the forum...