进度ABL:BREAK BY在OPEN QUERY中有多个连接

时间:2016-04-26 10:09:27

标签: progress-4gl openedge

我对ABL很新(我是法国人请原谅我的英语)所以我需要你的帮助。 我想知道如何在OPEN QUERY中使用BREAK BY。

这就是我的所作所为:

each LIG_RCP_FRN no-lock break by LIG_RCP_FRN.SKU-c-cod
   where LIG_RCP_FRN.SOU-c-Cod = ENT_RCP_FRN.SOU-c-Cod 
   and LIG_RCP_FRN.ERF-c-NumRcpFrn = ENT_RCP_FRN.ERF-c-NumRcpFrn,

我在以下声明中收到错误:

$review['review_date'] = date('F m, Y', strtotime($rev['added_date']));

之后无法理解:“LIG_RCP_FRN.SKU-c-cod”(我的错误是法语,但错误是247):

247 ** L'expressionaprès:“LIG_RCP_FRN.SKU-c-cod”estincompréhensible。 (247)

我想做的是能够从表LIG_RCP_FRN中总结一列,在SKU-c-Cod改变时中断。

我试图删除此错误后的每个语句,但它既不起作用。

请询问您是否需要更多信息。 开放进度10.2A

感谢您的帮助, Corentin

PS:在帖子中不可能说“嗨”

1 个答案:

答案 0 :(得分:4)

这是一个非常简单的错误。你需要把" BREAK BY"查询最后的选项。

如果您发布一些(可能是假的)临时表定义,这样可以很容易地进行复制和粘贴,这也非常好。

我根据查询在下面的代码中即兴创建了一些表,它们仅用于编写代码。

调用查询的FIRST-OF方法的工作方式如下:

  

查询:FIRST-OF(电平)

     

index:表示BREAK BY组的整数表达式,其中0表示整个查询,1表示第一个BREAK BY,2表示第二个BREAK BY,依此类推。

如果你有BREAK BY fieldA BY fieldB那么

query:FIRST-OF(1)BREAK BY fieldA

有关

query:FIRST-OF(2)BREAK BY fieldB

有关

还有LAST-OF(n)

/* Completely fake temp-tables that are here only to make the query work! */
DEFINE TEMP-TABLE ENT_RCP_FRN NO-UNDO
    FIELD STO-c-CodeDes   AS CHARACTER
    FIELD SOU-c-Cod       AS INTEGER
    FIELD ERF-c-NumRcpFrn AS INTEGER.

DEFINE TEMP-TABLE LIG_RCP_FRN NO-UNDO
    FIELD SOU-c-Cod       AS INTEGER
    FIELD ERF-c-NumRcpFrn AS INTEGER
    FIELD SKU-c-cod       AS INTEGER.

DEFINE TEMP-TABLE CONSO_UNV_MDIM NO-UNDO
    FIELD UMA-c-Code            AS CHARACTER
    FIELD CUMD-c-LstCleCumConso AS INTEGER.

DEFINE TEMP-TABLE LIG_DOC_TRS NO-UNDO
    FIELD SKU-c-Cod       AS INTEGER
    FIELD SOU-c-Cod       AS INTEGER
    FIELD EDT-c-NumDocTrs AS INTEGER.

DEFINE TEMP-TABLE ENT_DOC_TRS NO-UNDO
    FIELD SOU-c-Cod       AS INTEGER
    FIELD EDT-c-NumDocTrs AS INTEGER
    FIELD TR-c-CodeCatDoc AS CHARACTER
    FIELD STO-c-CodeOri   AS CHARACTER
    FIELD STO-c-CodeDes   AS CHARACTER.


DEFINE QUERY Q-REQ FOR ENT_RCP_FRN, LIG_RCP_FRN, CONSO_UNV_MDIM, LIG_DOC_TRS, ENT_DOC_TRS  SCROLLING.

OPEN QUERY Q-REQ FOR EACH ENT_RCP_FRN NO-LOCK WHERE ENT_RCP_FRN.STO-c-CodeDes = "DRET",
    EACH LIG_RCP_FRN NO-LOCK WHERE LIG_RCP_FRN.SOU-c-Cod = ENT_RCP_FRN.SOU-c-Cod 
                               AND LIG_RCP_FRN.ERF-c-NumRcpFrn = ENT_RCP_FRN.ERF-c-NumRcpFrn,
    EACH CONSO_UNV_MDIM NO-LOCK WHERE CONSO_UNV_MDIM.UMA-c-Code = "8B6A9/0001354"
                                 AND CUMD-c-LstCleCumConso = LIG_RCP_FRN.SKU-c-cod,
    EACH LIG_DOC_TRS NO-LOCK LEFT OUTER-JOIN WHERE LIG_DOC_TRS.SKU-c-Cod = LIG_RCP_FRN.SKU-c-Cod,
    EACH ENT_DOC_TRS NO-LOCK LEFT OUTER-JOIN WHERE ENT_DOC_TRS.SOU-c-Cod = LIG_DOC_TRS.SOU-c-Cod
                                               AND ENT_DOC_TRS.EDT-c-NumDocTrs = LIG_DOC_TRS.EDT-c-NumDocTrs
                                               AND ENT_DOC_TRS.TR-c-CodeCatDoc = "BT"
                                               AND ENT_DOC_TRS.STO-c-CodeOri = "DRET"
                                               AND ENT_DOC_TRS.STO-c-CodeDes = "DWHO" BREAK BY LIG_RCP_FRN.SKU-c-cod.


REPEAT:

     GET NEXT Q-REQ.
     IF NOT AVAILABLE ENT_RCP_FRN THEN LEAVE.

     IF QUERY q-req:FIRST-OF(1) THEN DO:
         DISPLAY "First!".
     END.

END.