doubt in index

sureshp

Member
When i execute this code

"FOR EACH Customer WHERE State = “NH” BY City:
DISPLAY CustNum Name City.
FOR EACH Order OF Customer:
DISPLAY OrderNum OrderDate ShipDate.
END.
END."

I got err :

** "Order of Customer". Index fields of table 1 must be fields in table 2. (230)
** Could not understand line 3. (196)


What do i do? Hlp me out........
 

mwm

New Member
You need to specify the field(s) needed to join the order table to the customer table.

Most likely, it will be something like "for each order where order.customer-nbr = customer.customer-nbr", but you need to verify this by finding the customer number index on the customer table first. If there is a field in the index before customer number, make sure you use it as well in your query.
 

TomBascom

Curmudgeon
"OF" tries to find an implied index to join the tables. It does this by assuming that like named fields imply a relationship. If those shared fields are in an index then an OF join will work. Otherwise you get the message that you see.

Using an explicit WHERE clause, as mwm suggests, will resolve the problem.

Personally I never use OF. I much prefer to explicitly state the relationship. I think that it makes for much clearer code.
 
Hi.,
As said use the direct relationship.
For example, if there are two tables named hmk and hmm. both of these shuld hav a common field (index) inorder to give it by OF.
if hmknum is a field common to both these tables then u can give as

FIND FIRST HMK OF HMM.

Then it relates the common field.

Make sure u have a common relation before u use this sentence always.

Better u can give this as,

FIND FIRST HMK WHERE HMK.HMKNUM = HMM.HMKNUM.

These both will work only if those two tables hav a relation.

Regards,
Santhosh.S
 

sridevi.stalin

New Member
@sureshp:

FOR EACH Customer WHERE State = "NH" BY City:
DISPLAY Cust-Num Name City.
FOR EACH Order OF Customer:
DISPLAY Order-Num Order-Date Ship-Date.
END.
END.

* The above code doesn’t give any error.
* The Report of the above query is that,
Cust-Num Name City
66 First Down Football Loudon

Order-Num Ordered Shipped
3 04/01/93 17/02/93
66 03/02/93 08/03/93
80 10/02/93 10/03/93
199 09/04/93

** Could not understand line 3. (196) will occur if the query fields name may be unknown, means, not specified in the table.
For example, in your query as showed here “CustNum, OrderNum, OrderDate, ShipDate” that I’ve used the Customer and Order table fields “Cust-Num, Order-Num, Order-date, Ship-Date”.

**"Order of Customer". Index fields of table 1 must be fields in table 2. (230) will occur if the Order of Customer is shorthand for where Order.Cust-Num = Customer.Cust-Num The OF phrase causes PROGRESS to look for a field of the same name and datatype in both tables. It confines its search to unique index fields of either Order or Customer. If a field is an array, it is ignored. If the common field is in a non-unique index, it is also ignored.
Friendly Advice:-
  • Practice to use Table-Name.Field-Name, then the Ambiguous will not occur.
 
Top