如何匹配正在进行的记录4GL?

问题描述 投票:-1回答:1

我在两个临时表中存储了两个字符值

CREATE tt_test1 NO-UNDO
FIELD Value_1 AS CHARACTER.

CREATE  tt_test1.
ASSIGN  tt_test1.Value_1 = "SBCL---DS----A3".

CREATE tt_test2 NO-UNDO
FIELD Value_2 AS CHARACTER.

CREATE tt_test2 NO-UNDO
ASSIGN tt_test2.Value_2 = "4+7+9+14,L-SA".

如果你看到tt_test2.Value_2是基于tt_test1.Value_1。

4 = L(tt_test1.Value_1的第4个字符)

7 = - (tt_test1.Value_1的第7个字符)

9 = S(tt_test1.Value_1的第9个字符)

14 = A(tt_test1.Value_1的第14个字符)

所以现在我的问题是如何比较tt_test1.Value_1和tt_test1.Value_2正确匹配?

如果它匹配,那么我需要在一个变量中分配。请帮忙这个案子。

openedge progress-4gl
1个回答
1
投票

您可以使用SUBSTRING()函数来比较各种第4,第7,第9和第14个字符。

就像是:

IF SUBSTRING( field1, 4, 1 ) = SUBSTRING( field2, 4, 1) and
   SUBSTRING( field1, 7, 1 ) = SUBSTRING( field2, 7, 1 ) and
   SUBSTRING( field1, 9, 1 ) = SUBSTRING( field2, 9, 1 ) and
   SUBSTRING( field1, 14, 1 ) = SUBSTRING( field2, 14, 1 ) THEN ...
© www.soinside.com 2019 - 2024. All rights reserved.