在进行4gl语言创建未发布(upost-order)订单的代码是什么?

时间:2016-03-31 15:44:43

标签: progress-4gl

使用4gl语言创建未发布(上调顺序)订单的代码是什么?

这是查找最高订单的代码。

FIND upost-order WHERE
  upost-order.company = company AND
  upost-order.order-number = order.order-number
  NO-ERROR.

IF NOT AVAILABLE upost-order THEN
FIND upost-order WHERE
  upost-order.company = company AND
  upost-order.order-number =
  STRING(INTEGER(SUBSTRING(order.order-number,3,6)))
  NO-LOCK NO-ERROR.

1 个答案:

答案 0 :(得分:1)

我假设您想知道如何为此实体创建新记录。 那将是

DO TRANSACTION:
   CREATE upost-order.
   /* Now if you want to assign arbitrary values to the key, */
   ASSIGN upost-order.company = company /* supposing you want to create for the same one you found */
          upost.order-number = cOrderNumber NO-ERROR. /* Whatever character value you want to assign to the number. */
 /* If you want to ask the user to input the values, on a GUI environment you could do this, instead of the ASSIGN above*/        
   UPDATE upost-order NO-ERROR.
/* You'll notice I used no-error in both. Now if an error happened, display it to the user */
   IF ERROR-STATUS:ERROR THEN DO:
        MESSAGE ERROR-STATUS:GET-MESSAGE(1) VIEW-AS    ALERT-BOX.
        UNDO, LEAVE.
   END.
END.

由于我正在解决更多关于如何创建的问题,当然上面的代码并不彻底或最佳。您可能有多条消息,并且在事务块中,我可能会命名它,并在创建和分配之前提示输入字段,从而在最短的时间内尽可能地保持事务处理。 我希望这对你的问题有帮助。