In this TIBCO step by step tutorial, I will explain how you can create a CSV file in TIBCO BW process using designer which you can later read and modify using Excel. CSV file will be created based on the records fetched from a database table.
Step 1: Create a TIBCO Process with JDBC Query Activity:
Create a process in TIBCO designer. I created a process with the name CreateCSVFile. In the process, add a JDBC query activity. This activity will fetch data from Oracle database table TBL_EMPLOYEE using following query:
Select * from tbl_employee
This table has following data already inserted by me:
I assume that you have already created a database connection in your TIBCO BW Project which you will reference in this activity.
JDBC Query activity configuration will look like below:
When you click on Fetch button and then go to output tab of JDBC Query, it should look like below:
Step 2: Add Write File Activity in TIBCO BW Process:
For creating csv file, add Write File activity in the process. Configuration of Write File activity will be as shown below:
Since we want to loop through the records fetched from database and write them in comma separated from in a csv file, we need to put this Write File activity in a group. Create a group on this activity as shown below:
In the input tab of Write File activity configuration, I have specified the name of the file (Employee.csv).
Employee.csv file is already created by me in the given location with only header information pre-populated as shown below:
Input for this file is also specified in textContent mapping in input tab which is comma separated information fetched from database. XPath for textconent is given below:
Please note that I have used carriage line return in this XPath so that every record is written in a new line in the csv file.
Input tab of create csv file will now look like below:
Step 3: Test the Process and Verify CSV file:
Now we are done with all necessary configurations of activities used in our TIBCO designer process. Validate the project to make sure that all is fine. Once validated successfully, we can move towards testing of the process.
In designer tester, load the process and start it. As you can see below, it has run successfully.
Now we need to go to the location where our csv file has been written and verify its contents. As you can see in below screenshot, information fetched from Oracle database table has been written in csv file in proper format:
You can now open this csv file using Excel and you can see below that file content have been written correctly in the file. Now you can play with this file and enjoy.