{{tag>category:"OpenInsight Specific"}}
[[https://www.revelation.com/|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]]
==== Can't Create A Relational Index (OpenInsight Specific) ====
=== At 14 OCT 1998 06:47:09PM Greg James, ISIS, Inc. wrote: ===
After restoring an application with APPBACKUP I reattached the tables. In database manager List Indexed Tables only shows one indexed table (SYSREPOSLOCKS). Before I backed-up the application there were three relational indexes for the application.
When I tried to add a relational index I saw the following message:
"Index type "3" has already been created for the column ""."
I can see the ! file in the system editor, but when I execute:
RUN DELETE_INDEX '','','3' I get an error.
Is the index there or not? If it is, how do I get rid of it, and if it's not, how can I add a new index?
----
=== At 19 OCT 1998 09:48AM Cameron Revelation wrote: ===
Greg,
It sounds like you need to manually remove it. Open the DICT. table and look at the record that purportedly has an index. Clear the following fields:
6 (DICT_INDEX_FLAG$)
21 (DICT_DEPENDENT$)
22 (DICT_XREF$)
23 (DICT_RELATIONAL$)
24 (DICT_RELATED$, related to DICT_RELATIONAL$)
25 (DICT_PROTECT$, related to DICT_RELATIONAL$)
Below is the code for List_Index, to give you a reference point for how this info is stored.
routine List_Index(pTableNameList, pColumnNameList, pIndexTypeList)
RowDef(CharStr, CharStr, Integer, Integer, Integer)
*****************************************************************************
*
* Name : List_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
*
* ROWDEF structure:
* Table Name
* Column Name
* Btree Flag
* Crossref Flag
* Relational Flag
*
* History (Date, Initials, Notes)
* 10/01/97 cp Re-did.
* 10/27/97 cp Sort table list (this used to be done by RTP50 select)
*
*****************************************************************************
declare subroutine Set_Status, V119
declare function Send_Dyn
$insert Dict_Equates
$insert FSErrors_Hdr
$insert Logical
******
* main
******
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
Outrec =0: @fm: 0: @fm: 0
bIndexed="
if index(IndexTypeList, 1, 1) then
if Record then
bIndexed =TRUE$
OutRec=TRUE$
end
end
if index(IndexTypeList, 2, 1) then
if len(Record) then
bIndexed =TRUE$
OutRec=TRUE$
end
end
if index(IndexTypeList, 3, 1) then
if len(Record) then
bIndexed =TRUE$
OutRec=TRUE$
end
end
if bIndexed then
Stat=Send_Dyn(TableName: @fm: ColumnName: @fm: OutRec)
if Stat then
Set_Status(TRUE$, Stat)
return
end
end
end
end
end
next iColumn
end else
ErrArgs=@file.error
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
Hope it helps,
Cameron Purdy
Revelation Software
[[https://www.revelation.com/revweb/oecgi4p.php/O4W_HANDOFF?DESTN=O4W_RUN_FORM&INQID=NONWORKS_READ&SUMMARY=1&KEY=8AD332BA992276428525669D007D2AE0|View this thread on the forum...]]