我很抱歉这是一个非常简单的问题,但作为 ABL 开放边缘的第一次用户,我卡住了。我在这样的表中输入了值
METHOD PRIVATE VOID POPULATETABLE ( ):
DEFINE VARIABLE I AS INTEGER.
DO I = 0 TO 100:
CREATE TEST.
ASSIGN TEST.CUSTOMER_NAME="SMITH"
TEST.ORDER_NUMBER=I
TEST.ORDER="BOOKS"
TEST.COST=45.00
TEST.CUSTOMER_NAME = "JACKSON"
TEST.ORDER_NUMBER=I
TEST.ORDER="PAPER CLIPS"
TEST.COST=1.7.
ASSIGN TEST.CUSTOMER_NAME="JONES"
TEST.ORDER_NUMBER =I
TEST.ORDER="PENCILS"
TEST.COST=2.50
TEST.CUSTOMER_NAME = "TURNER"
TEST.ORDER_NUMBER = I
TEST.ORDER="PENS"
TEST.COST=0.7.
END.
END METHOD.
我正在尝试使用它显示它们
FOR EACH TEST:
DISPLAY TEST.COST TEST.CUSTOMER_NAME TEST.ORDER TEST.ORDER_NUMBER.
RETURN.
END.
但是,结果仅显示输入的最后一行数据。 谁能帮忙,我什至不确定显示功能是否正确或分配是否正确。
FOR EACH 中的"return"导致代码在第一条记录后离开循环。删除该语句,您将看到所有记录。
FOR EACH TEST:
DISPLAY TEST.COST
TEST.CUSTOMER_NAME
TEST.ORDER
TEST.ORDER_NUMBER.
RETURN. /* this is why you're only seeing one record - */
/* get rid of this and you'll see all the records */
END.
我会避免分配 0 的 order#。 它只是要求混淆人们。
define variable i as integer no-undo.
do i = 1 to 100:
create test.
assign
test.order_number = i
test.customer = "smith" /* you need some way to get */
test.order = "books" /* actual data for the rest */
test.cost = random( 10, 100) /* of the fields... */
.
end.
然后查看订单:
for each test no-lock:
display test.
end.
是的,我所需要的只是为每个记录的每个分配创建一个创建语句,这很有效。谢谢大家,工作编码如下所示:
CREATE TEST.
ASSIGN TEST.CUSTOMER_NAME="SMITH"
TEST.ORDER_NUMBER=I
TEST.ORDER="BOOKS"
TEST.COST=45.00.
CREATE TEST.
ASSIGN TEST.CUSTOMER_NAME = "TAYLOR"
TEST.ORDER_NUMBER=I
TEST.ORDER="PAPER CLIPS"
TEST.COST=1.7.
CREATE TEST.
ASSIGN TEST.CUSTOMER_NAME="THOMPSON"
TEST.ORDER_NUMBER =I
TEST.ORDER="PENCILS"
TEST.COST=2.50.
CREATE TEST.
ASSIGN TEST.CUSTOMER_NAME = "TURNER"
TEST.ORDER_NUMBER = 2
TEST.ORDER="PENS"
TEST.COST=0.7.
对于每个测试在哪里测试。成本> 1.3 通过测试。ORDER_NUMBER: 显示测试。 结束。