Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the following issue: I am taking records from several tables and then I combine them with tUnite component in order to create a .txt file. After that I sort retrieved rows based on a certain field. The output file is like this:
myField my2ndField ... ... HeaderRecord xxxxx DetailRecord xxxxx DetailRecord xxxxx AdditionalRecord empty -> field I want to calculate for Additional Record DetailRecord xxxxx DetailRecord xxxxx AdditionalRecord empty -> field I want to calculate for Additional Record DetailRecord xxxxx AdditionalRecord empty -> field I want to calculate for Additional Record
This is my job:
What I want to do is to calculate "myField" just for "AddionalRecord" (TAB3). This Field is a Progressive number which must works like showed in the screenshot below.
How can I achieve my goal after I merge records with tUnite?
myField my2ndField ... ...
HeaderRecord xxxxx
DetailRecord xxxxx
DetailRecord xxxxx
AdditionalRecord 000000004 -> field I want to calculate for Additional Record
DetailRecord xxxxx
DetailRecord xxxxx
AdditionalRecord 000000007
DetailRecord xxxxx
AdditionalRecord 000000009
No, I did not. I looked it, but I does not seem the solution to my issue. I need a progressive for additional row and I write it to file.
Ok, from what I was able to figure out something like this would match your needs.
Before outputting the final output to your file make it pass through tMap and work on the below logic -
So, you would be generating a sequence but displaying it only when the field value is null ( or empty or in whatever form you are getting the data).
Relational.ISNULL(row1.myField) ? String.valueOf(Var.var1) : row1.myField
I tryied to do something like that, but with a table as output and it worked. The problem was that if I have more than one table with additional record it does not work anymore.
Anyway, as you suggest it almost worked.
Record is added to all fields and on the contrary I want to add it only for those one where row6.message_type_id!="0100" . I link tMap to fileOutputDelimited by using the following condition in myField:
row6.message_type_id!="0100"?String.format("%08d",Numeric.sequence("s3",2,1)):" "
Could you help me with some sample data so that I would be able to understand the situation a bit more.
Try adding the sequence to tMap variable and then refer it to your row6.message_type_id based on the condition that you have defined.
Also, when you connect your tMap to tFileOutputDelimited I believe it would not be row6 as this is the input to tMap but not the output from tMap. It definitely is something else that you have created as part of your output table inside tMap.
I attached my tMap below:
This the actual result of my .txt:
Actual Result: tFileOutputDelimited