If your "file" type tree is just a blob object - a text item of no set length limit or any terminators defined in the type tree...
Do you have line terminators within this text field? How would you recognize the "line" as the last line? This will give you clues as to how to parse with WTX functions.
For instance, if I have the following in the text field:
Hello, my name is Inigo Montoya. You killed my father. Prepare to die.
Here the "delimiter" separator is a period "." and the last line might be considered "Prepare to die." Whereas in this example:
Did you know that the first Matrix was designed to be a perfect human world? Where none suffered, where everyone would be happy. It was a disaster. No one would accept the program. Entire crops were lost.
Some believed we lacked the programming language to describe your perfect world. But I believe that, as a species, human beings define their reality through suffering and misery. The perfect world was a dream that your primitive cerebrum kept trying to wake up from. Which is why the Matrix was redesigned to this: the peak of your civilization. I say your civilization, because as soon as we started thinking for you it really became our civilization, which is of course what this is all about.
Evolution, Morpheus, evolution. Like the dinosaur. Look out that window. You've had your time. The future is *our* world, Morpheus. The future is our time.
In this example the last line can be distinguished by 2 things - there is a new line at the beginning (and possibly at the end - you'd have to look at the contents in a HEX Editor to be sure) as well as the period. The last line here could be defined by the fact that it is it's own paragraph or just "The future is our time." which is the last sentence of the last line the way I see it - but you need to understand the business rule that you are required to replicate.
Either way - there are several functions you can use to get to either of these answers.
- Define a better type tree to parse the data by defining you repeating text items into whatever makes them "lines".
- If you leave it blob data - make use of the WORD function to make the logical separators. If you use a negative number it will start from the end vs the beginning of the string .i.e. WORD(renglón, ".", -2) Would get the last sentence (without the trailing .) in either example.
- You can nest functions as well to make a complex solution using functions like RIGHT, INDEX, FIND or COUNT to get to the data needed. The functions all have some helpful hints in the designer and Rex has provided the link to online documentation as well.
Happy mapping!
------------------------------
Lisa Edwards
Software Engineer / Subject Matter Expert
Rainbow Data Systems, Inc
------------------------------
Original Message:
Sent: Tue July 23, 2024 12:46 PM
From: Rodrigo Ricardo Pérez memije
Subject: WTX Transform extender design studio ¿Function that read the last entire row?
Thanks for your kind response. In my case, there is a field called 'renglón' that is in a group; that's my type tree. Is very simple ,The file comes to me from a primary document, and I put everything into that 'renglón' field. From there, I need to see how I can extract the last line of the file.
------------------------------
Rodrigo Ricardo Pérez memije
Original Message:
Sent: Tue July 23, 2024 11:34 AM
From: Rex Chan
Subject: WTX Transform extender design studio ¿Function that read the last entire row?
It depends on how you define your type tree. Usually the last line may contain some summary information and it's represented in the type tree. In this case, you can drag the object to the output card and either use the Sterling adapter to write to ProcessData or write it to a file followed by a FileSystemAdapter service to write it to ProcessData.
------------------------------
Rex Chan
Original Message:
Sent: Mon July 22, 2024 02:52 PM
From: Rodrigo Ricardo Pérez memije
Subject: WTX Transform extender design studio ¿Function that read the last entire row?
Hello everyone, I am new to WTX. My question is, is it possible with a function to read the last line of an input file, that is, to read the entire last row to extract that information and send it to processdata or somewhere else? ty for ur time
------------------------------
Rodrigo Ricardo Pérez memije
------------------------------