Query problem

Posted by sgi on 23-Mar-2007 13:40

Hi,

I have a table of head-boards of documents and other one of lines of these documents that contain articles. On the other hand I have the table of articles that have the value of the brand(mark).

Since I can know those documents that have a brand(mark) in concretly?

Example that duplicates head-boards of documents:

FOR EACH document NO-LOCK,

EACH lines OF document NO-LOCK,

FIRST items WHERE items.item-num EQ lines.item-num AND

items.mark EQ 'ADIDAS' NO-LOCK:

DISPLAY document.

END.

Another example that does not go out at all if the brand(mark) that looks for this one in the second line:

FOR EACH document NO-LOCK,

FIRST lines OF document NO-LOCK,

FIRST items WHERE items.item-num EQ lines.item-num AND

items.mark EQ 'ADIDAS' NO-LOCK:

DISPLAY document.

END.

Since I can obtain a good result?

Thank you for his(her,your) collaboration

Excuse if the explanation is not very clear, I have used a translator

Regards,

Quim

All Replies

Posted by Håvard Danielsen on 26-Mar-2007 13:55

This question does not seem relevant to ADM2 or Dynamics.

Try the "programing in the ABL" forum.

--

You would not use FIRST to access records in a one-to-many relationship, like lines of Document, unless you really only want one specific record.

It is often more efficient to start at the most limiting parent when accessing many-to-many tables (document -> lines

for

each item where items.mark = 'ADIDAS' no-lock,

each lines where lines.item-num = items.itemm-num no-lock,

each document of lines no-lock:

end.

This thread is closed