Talab - bir qator, bir qator chiqish qatorlari soni

Background: It's common in Talend to use something like tSplitRow to map one row with many fields into multiple rows. A row with fields:

Date | Name | MorningPhone | Day Phone | EveningPhone ...could be split into:

Date | Name | Phone ... and you'll always have 3 resulting rows from one row.


Question: What if I want number of rows from a variable number of fields?

I have a schema: UniqueID | FieldSet where FieldSet is a delimited field of columns divisible by nine. If there are 45 fields, in this delimited column, I want 5 rows. 81 fields => 9 rows.

TJavaRow-ni maydonlarni ajratish uchun ishlatmoqchiman, lekin men tegishli maydonlarni yaratish uchun tSplitRow bilan qanday biriktirishni bilmayman.

Fikrlar? Rahmat!

0

2 javoblar

Men maxsus tJavaRowdan foydalandim - bu maxsus formatlangan simni yangi stolga aylantirdi. Hackni tuzish, lekin u ishladi.

String input = "";
String OUT = "";


try {
      input = java.net.URLDecoder.decode(input_row.CustomField16, "ASCII");

} catch (UnsupportedEncodingException e) {
      e.printStackTrace();
}

String[] pieces = input.split(";");

/*for(int a=0; a
2
qo'shib qo'ydi
Bu usul eskirgan. Iltimos, quyida javob bering
qo'shib qo'ydi muallif Daniel San, manba
Buni qilishning eng yaxshi yo'li haqida o'ylay olmayman.
qo'shib qo'ydi muallif drmirror, manba

Ushbu savol yuzaga kelgandan buyon rivojlanish davom etmoqda va buni amalga oshirishning yana bir yaxshi usuli tNormalize komponentidan foydalanishdir.

enter image description here

Birinchidan, biz bu kabi faylni kiritamiz:

pepe|123|123
juan|454|2423|34343|5454

Ushbu faylni tFileInputRegex komponentidan foydalanib o'qib chiqdik. Biz muntazam ifodani va sxemani aniqlab olishimiz kerak. Muntazam ifoda quyidagicha bo'ladi:

"^([^|]+)\\|(.+)"

Diagramma quyidagicha bo'ladi:

enter image description here

Keyinchalik, tNormalize bilan tFileInputRegex ulanamiz. Separatorni quyidagicha o'rnatamiz:

"\\|"

Va nihoyat biz kerakli mahsulotni ishlatamiz.

1
qo'shib qo'ydi