Providing the name of a file (for reading or writing) dynamically

Sometimes, you don't have the complete name of the file that you intend to read or write in your transformation. That can be because the name of the file depends on a field or on external information. Suppose you receive a text file with information about new books to process. This file is sent to you on a daily basis and the date is part of its name (for example, newBooks_20100927.txt).

Getting ready

In order to follow this recipe, you must have a text file named newBooks_20100927.txt with sample book information such as the following:

"Title","Author","Price","Genre" "The Da Vinci Code","Dan Brown","25.00","Fiction" "Breaking Dawn","Stephenie Meyer","21.00","Children" "Foundation","Isaac ...

Get Pentaho Data Integration Cookbook Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.