Talend:匹配2列并仅显示这些值匹配的行

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

我是Talend的初学者,如果有人可以帮助我,我很感激...

如何将邮政编码ex:69000的前2位数字与包含值69的另一列相匹配。然后仅显示这些值匹配的行。 (附有完整数据的Excel文件)

以下数据示例:

ID, CompanyName, CodePostal, City, DepartementNumber, Region

5   TELMAT INFORMATIQUE 69000   LYON    66  pyrenees-orientales

5   TELMAT INFORMATIQUE 69000   LYON    67  bas-rhin

5   TELMAT INFORMATIQUE 69000   LYON    68  haut-rhin

**5 TELMAT INFORMATIQUE 69000   LYON    69  rhone**

5   TELMAT INFORMATIQUE 69000   LYON    70  haute-saone

5   TELMAT INFORMATIQUE 69000   LYON    71  saone-et-loire

5   TELMAT INFORMATIQUE 69000   LYON    72  sarthe

5   TELMAT INFORMATIQUE 69000   LYON    73  savoie

提前致谢

talend
2个回答
0
投票

你可以使用REGEX:

https://help.talend.com/reader/JhYq1xxY0SNSBZCbOFzZGg/W8cU~47SzE__OIkoOg5JrA

^

Start of string, or start of line in a multi-line pattern

^Comment matches "Comment" at the beginning of the line.

^C.* matches the first line.

例如在mysql中我们有:

select * FROM companies WHERE CodePostal REGEXP '^(69)' 

在laravel我们有:

->where('slug', 'regexp', "^(69)")

0
投票

你可以在tMap的输出上使用一个简单的过滤器,只允许验证条件的记录:

StringHandling.LEFT(row.CodePostal, 2).equals(row.DepartementNumber)

您必须在String对象上使用equals方法,使用==将不起作用。

© www.soinside.com 2019 - 2024. All rights reserved.