Kbase P124888: Error 446 when there is only a single primary unique index with OF phrase.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  7/17/2007 |
|
Status: Unverified
FACT(s) (Environment):
All Supported Operating Systems
Progress/OpenEdge Versions
SYMPTOM(s):
Error 446 when there is only a single primary unique index with OF phrase.
** More than one index found for <table> OF <table> -- use WHERE,not OF. (446)
When using the OF phrase in a FOR each statement, and there is only a single unique index in both tables, this can result in error 446.
CAUSE:
This is expected behavior and relates to the relations that are defined by the indexes in the tables. Basically the 'OF' chooses a relation to make the join, and the OF join is simply a shorthand way of writing 'WHERE indexed-field = value AND indexed-field = value'. This is effectively what the compiler tries to do when it encounters an OF in code.
For example, if there are two tables defined as follows:
table "OrderHdr"
fields: Ordenum, Salesrep.
Primary Unique Index Ordhdr (Ordernum).
table "OrderDet"
fields: Ordernum, Salesrep.
Primary Unique Index Orddet (Ordernum, Salesrep).
Due to the indexes there are multiple relations between them which can be seen by running the Relations Report from the Data Dictionary, Database->Reports->Table Relations. Each table has 2:
OrderHdr:
OrderDet OF OrderHdr (Ordernum)
OrderHdr OF OrderDet (Ordernum, Salesrep)
tagabs:
OrderHdr OF OrderDet (Ordernum, Salesrep)
OrderDet OF OrderHdr (Ordernum)
The unique indexes contain the Ordernum, and Ordernum + Salesrep fields. And Progress knows that both fields (Ordernum and Salesrep) are actually in both tables, but they are not in both indexes. So the compiler does not know how to specify its WHERE clause. Should it include the Salesrep field, or shouldn't it? This ambiguity is why the 446 error occurs, and the compiler via the 446 error is asking the Developer to resolve it.
FIX:
The fact that the Salesrep field is in both tables, but not in both indexes suggests that perhaps the data has not been normalized correctly, or:
1. This field is not necessary on this table
2. This field is empty in this table.
3. This field has different information than it does in the OrderHdr table.
So the problem can be resolved by removing the salesrep field from the OrderHdr table. Alternatively, specify a WHERE clause on the FOR EACH statement.